Quantcast
Channel: Microcontrollers
Viewing all articles
Browse latest Browse all 226318

Forum Post: RE: TMS570LC4357: Can the CPU jump to the FLASH OTP area to address and execute the program?

$
0
0
Sorry, maybe I didn't it well.You are correct, the program must be loaded at address 0 to start. Note that I'm experimenting with bank 7 now, but ultimately it's to experiment with programs in the bank 0 OTP region. 1. first program(0 address) 1.1 开启bank7的执行权限 1.2 main函数 /* USER CODE BEGIN (0) */ #include "Types.h" #include "F021.h" #include "HL_reg_flash.h" #include "sci_common.h" #include "HL_sci.h" #include "HL_reg_sci.h" #include "HL_gio.h" #include "HL_reg_gio.h" /* USER CODE END */ /* Include Files */ #include "HL_sys_common.h" /* USER CODE BEGIN (1) */ #define SYS_CLK_FREQ 150 #define OTP_ADDR 0xF0002020U #define BANK7_ADDR 0xF0200000U Fapi_StatusType Fapi_serviceWatchdogTimer(void); uint8_t DataBuffer[4] = {0x55,0x66,0x77,0x88}; uint8_t ReadBuffer1[48] = {0}; uint8_t ReadBuffer2[4] = {0}; Fapi_StatusType Return_Status; uint32_t i = 0; uint8_t OtpBuffer[48] = {0}; /* USER CODE END */ /** @fn void main(void) * @brief Application main function * @note This function is empty by default. * * This function is called after startup. * The user can use this function to implement the application. */ /* USER CODE BEGIN (2) */ /* USER CODE END */ int main(void) { /* USER CODE BEGIN (3) */ sciInit(); gioInit(); gioSetDirection(gioPORTB, 0xFFFFFFFF); if ((Fapi_initializeFlashBanks((uint32_t)SYS_CLK_FREQ)) == Fapi_Status_Success){ Fapi_setActiveFlashBank(Fapi_FlashBank7); /*Activate the Bank-7 for write*/ Fapi_enableEepromBankSectors(0xFFFFFFFF,0); /*Enabling All 32 sectors in Bank-7 for programming*/ // Fapi_enableBanksForOtpWrite(0x01); while( FAPI_CHECK_FSM_READY_BUSY != Fapi_Status_FsmReady ); } Fapi_doMarginReadByByte((uint8_t*)BANK7_ADDR,ReadBuffer1,48,Fapi_NormalRead); while( FAPI_CHECK_FSM_READY_BUSY == Fapi_Status_FsmBusy ); while(FAPI_GET_FSM_STATUS != Fapi_Status_Success); for(i = 0; i < 48; i++){ UART_txByte(sciREG1, ReadBuffer1[i]); } //UART_putString(sciREG1, "/r/n"); // // Return_Status = Fapi_issueProgrammingCommand((uint32_t*)0xF0000010,DataBuffer,4,0,0,Fapi_AutoEccGeneration); /*Programming data to 8th sector*/ // while( FAPI_CHECK_FSM_READY_BUSY == Fapi_Status_FsmBusy ); // while(FAPI_GET_FSM_STATUS != Fapi_Status_Success); // // Fapi_doMarginReadByByte((uint8_t*)0xF0000010,ReadBuffer2,4,Fapi_NormalRead); // while( FAPI_CHECK_FSM_READY_BUSY == Fapi_Status_FsmBusy ); // while(FAPI_GET_FSM_STATUS != Fapi_Status_Success); // UART_putChar(sciREG1, "hello"); // Flash_ReadBlock(OTP_ADDR, OtpBuffer, 48); // for(i = 0; i < 48; i++){ // UART_txByte(sciREG1, OtpBuffer[i]); // } ((void (*)(void))0xF0200000U)(); while(1){ gioToggleBit(gioPORTB, 6); for(i = 0; i < 10000000; i++); } /* USER CODE END */ return 0; } /* USER CODE BEGIN (4) */ Fapi_StatusType Fapi_serviceWatchdogTimer(void) { ; } /* USER CODE END */ 2. led program(bank7 address) For this program I burned the .bin file to location 0xF0200000 via uniflash. See my previous reply for the contents of the linked file. 3. The burn 0 address program did not erase bank7 and the debug result is shown below. Can you help me analyze what problem is causing this? If the bank7 experiment passes, I will test if the app program in the OTP area works. Looking forward to your reply, thanks.

Viewing all articles
Browse latest Browse all 226318

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>