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

Forum Post: TMS570LC4357: Bootloader issues TMS570LC4357

$
0
0
Part Number: TMS570LC4357 Other Parts Discussed in Thread: TMS570LS0714 , TMS570LS0914 , Tool/software: Hello all, I am trying to port the Bootloader code I successfully use with another micro of this family (TMS570LS0714) and ran across some issues. In particular, it seems I was able to solve most of them but I struggle to move on due to an issue with interrupts. What I am trying to debug the issue right now is simply to add an RTI Compare 0 interrupt that will blink the 2 user led on the dev board, however with the usual bl_Link.cmd file as soon as I call "_enable_IRQ_interrupt" the device goes into bootloop. Below my cmd file and main file where this is executed Linker: /* Linker Settings */ --retain="*(.intvecs)" /* USER CODE BEGIN (1) */ /* USER CODE END */ /*----------------------------------------------------------------------------*/ /* Memory Map */ MEMORY { /* USER CODE BEGIN (2) */ /* USER CODE END */ VECTORS (X) : origin=0x00000000 length=0x00000020 vfill = 0xffffffff FLASH0 (RX) : origin=0x00000020 length=0x001FFFE0 vfill = 0xffffffff FLASH1 (RX) : origin=0x00200000 length=0x00200000 vfill = 0xffffffff SRAM (RWX) : origin=0x08002000 length=0x0002D000 STACK (RW) : origin=0x08000000 length=0x00002000 /* USER CODE BEGIN (3) */ /* ECC_VEC (R) : origin=0xf0400000 length=0x4 ECC={algorithm=algoL2R5F021, input_range=VECTORS } ECC_FLA0 (R) : origin=0xf0400000 + 0x4 length=0x3FFFC ECC={algorithm=algoL2R5F021, input_range=FLASH0 } ECC_FLA1 (R) : origin=0xf0440000 length=0x40000 ECC={algorithm=algoL2R5F021, input_range=FLASH1 } */ #if 1 ECC_VEC (R) : origin=(0xf0400000 + (start(VECTORS) >> 3)) length=(size(VECTORS) >> 3) ECC={algorithm=algoL2R5F021, input_range=VECTORS} ECC_FLA0 (R) : origin=(0xf0400000 + (start(FLASH0) >> 3)) length=(size(FLASH0) >> 3) ECC={algorithm=algoL2R5F021, input_range=FLASH0 } ECC_FLA1 (R) : origin=(0xf0400000 + (start(FLASH1) >> 3)) length=(size(FLASH1) >> 3) ECC={algorithm=algoL2R5F021, input_range=FLASH1 } #endif /* USER CODE END */ } /* USER CODE BEGIN (4) */ ECC { algoL2R5F021 : address_mask = 0xfffffff8 /* Address Bits 31:3 */ hamming_mask = R4 /* Use R4/R5 build in Mask */ parity_mask = 0x0c /* Set which ECC bits are Even and Odd parity */ mirroring = F021 /* RM57Lx and TMS570LCx are build in F021 */ } /* USER CODE END */ /*----------------------------------------------------------------------------*/ /* Section Configuration */ SECTIONS { /* USER CODE BEGIN (5) */ /* USER CODE END */ .intvecs : {} > VECTORS /* The toot directory is \Debug */ flashAPI: { .\source\Fapi_UserDefinedFunctions.obj (.text) .\source\bl_flash.obj (.text) --library= "c:\ti\Hercules\F021 Flash API\02.01.01\F021_API_CortexR4_BE_L2FMC.lib" (.text) } palign=8 load = FLASH0 |FLASH1, run = SRAM, LOAD_START(apiLoadStart), RUN_START(apiRunStart), SIZE(apiLoadSize) .text : {} palign=8 > FLASH0 |FLASH1 /*Initialized executable code and constants*/ .const : {} palign=8 > load=FLASH0 |FLASH1, run = SRAM, LOAD_START(constLoadStart), RUN_START(constRunStart), SIZE(constLoadSize) /*Initialized constant data (e.g. const flash_sectors[..] = )*/ .cinit : {} palign=8 > FLASH0 |FLASH1 /*Initialized global and static variables*/ .pinit : {} palign=8 > FLASH0 |FLASH1 .data : {} > SRAM .bss : {} > SRAM .sysmem : {} > SRAM /* USER CODE BEGIN (6) */ FEE_TEXT_SECTION : {} > FLASH0 | FLASH1 FEE_CONST_SECTION : {} > FLASH0 | FLASH1 FEE_DATA_SECTION : {} > SRAM /* USER CODE END */ } /* USER CODE BEGIN (7) */ /* USER CODE END */ /*----------------------------------------------------------------------------*/ /* Misc */ /* USER CODE BEGIN (8) */ /* USER CODE END */ /*----------------------------------------------------------------------------*/ Main File: #include "bl_config.h" #include "sci_common.h" #if defined (CAN_ENABLE_UPDATE) #include "bl_can.h" #endif #if defined (SPI_ENABLE_UPDATE) #include "bl_spi.h" #endif #if defined (UART_ENABLE_UPDATE) #include "bl_uart.h" #endif #if defined (RM57) || defined (TMS570LC43) #include "HL_het.h" #include "HL_gio.h" #include "HL_sci.h" #include "HL_system.h" #include "HL_sys_common.h" #include "HL_sys_core.h" #else #include "het.h" #include "sci.h" #include "gio.h" #include "system.h" #include "sys_common.h" #include "sys_core.h" #endif #include "bl_check.h" #include "bl_led_demo.h" #include "HL_rti.h" uint32_t ms = 0; /***************************************************************************** * bl_main ******************************************************************************/ #if defined (SPI_ENABLE_UPDATE) || defined(UART_ENABLE_UPDATE) || defined(CAN_ENABLE_UPDATE) /***************************************************************************** * * This holds the current remaining size in bytes to be downloaded. * ******************************************************************************/ uint32_t g_ulTransferSize; /***************************************************************************** * * This holds the current address that is being written to during a download * command. * ******************************************************************************/ uint32_t g_ulTransferAddress; /***************************************************************************** * * This is the data buffer used during transfers to the boot loader. * ******************************************************************************/ uint32_t g_pulDataBuffer[BUFFER_SIZE]; /***************************************************************************** * * This is the data buffer used for update status. * * g_pulUpdateSuccess[] are used to store application update status and application * image's version etc ******************************************************************************/ uint32_t g_pulUpdateSuccess[8] = {0x5A5A5A5A, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; uint32_t g_ulUpdateStatusAddr = APP_STATUS_ADDRESS; uint32_t g_ulUpdateBufferSize = 32; /*16 bytes or 4 32-bit words*/ #define E_PASS 0 #define E_FAIL 0x1U #define E_TIMEOUT 0x2U /***************************************************************************** * * This is an specially aligned buffer pointer to g_pulDataBuffer to make * copying to the buffer simpler. It must be offset to end on an address that * ends with 3. * ******************************************************************************/ uint8_t *g_pucDataBuffer; extern unsigned int apiLoadStart; extern unsigned int apiLoadSize; extern unsigned int apiRunStart; extern unsigned int constLoadStart; extern unsigned int constLoadSize; extern unsigned int constRunStart; /***************************************************************************** * * This holds the current address that is being written to during a download * command. * ******************************************************************************/ void delay(unsigned int delayval) { while(delayval--); } //extern void _copyAPI2RAM_(unsigned int* r0, unsigned int* r1, unsigned int* r2); void main(void) { g_pulUpdateSuccess[3] = 0x30002019; /*version number, 03.00, in 2019*/ uint32_t fnRetValue = 0; /* Initialize SCI Routines to receive Command and transmit data */ sciInit(); gioInit(); /* Initialize RTI driver */ rtiInit(); /* Set high end timer GIO port hetPort pin direction to all output */ gioSetDirection(hetPORT1, 0xFFFFFFFF); /* Enable RTI Compare 0 interrupt notification */ rtiEnableNotification(rtiREG1,rtiNOTIFICATION_COMPARE0); /* Enable IRQ - Clear I flag in CPS register */ /* Note: This is usually done by the OS or in an svc dispatcher */ _enable_IRQ_interrupt_(); /* Start RTI Counter Block 0 */ rtiStartCounter(rtiREG1,rtiCOUNTER_BLOCK0); /* Copy the flash APIs to SRAM*/ //_copyAPI2RAM_(&apiLoadStart, &apiRunStart, &apiLoadSize); memcpy(&apiRunStart, &apiLoadStart, (uint32)&apiLoadSize); /* Copy the .const section */ //_copyAPI2RAM_(&constLoadStart, &constRunStart, &constLoadSize); memcpy(&constRunStart, &constLoadStart, (uint32)&constLoadSize); #if defined (SPI_ENABLE_UPDATE) UART_putString(UART, "\r Hercules MCU SPI BootLoader "); #endif #if defined (CAN_ENABLE_UPDATE) UART_putString(UART, "\r Hercules MCU CAN BootLoader "); #endif #if defined (UART_ENABLE_UPDATE) UART_putString(UART, "\r Hercules MCU UART BootLoader "); #endif UART_putString(UART, "\r TI DSP Application Team, qjwang@ti.com \r\r"); // // See if an update should be performed. // fnRetValue = CheckForceUpdate(); //fnRetValue = 0; //qj for testing application code if ( !fnRetValue ) { #ifdef DEBUG_MSG UART_putString(UART, "\r Jump to application... "); #endif g_ulTransferAddress = (uint32_t)APP_START_ADDRESS; ((void (*)(void))g_ulTransferAddress)(); } // // Configure the microcontroller. // //EnterBootLoader #ifdef CAN_ENABLE_UPDATE ConfigureCANDevice(CAN_PORT); #endif #ifdef SPI_ENABLE_UPDATE ConfigureSPIDevice(SPI_PORT); #endif #ifdef UART_ENABLE_UPDATE ConfigureUartDevice(); #endif // // Branch to the update handler. Use can1 // #ifdef CAN_ENABLE_UPDATE UpdaterCAN(CAN_PORT); #endif #ifdef UART_ENABLE_UPDATE UpdaterUART(); #endif #ifdef SPI_ENABLE_UPDATE UpdaterSPI(SPI_PORT); #endif } /****************************************************************************** * * Configures the microcontroller. * * This function configures the peripherals and GPIOs of the microcontroller, * preparing it for use by the boot loader. The interface that has been * selected as the update port will be configured, and auto-baud will be * performed if required. * * \return None. * ******************************************************************************/ #ifdef SPI_ENABLE_UPDATE void ConfigureSPIDevice(spiBASE_t *node) { // // Initialize the SPI1 as slave mode // Enable the SPI interface in slave mode. // Set the SPI protocol to Motorola with default clock high and data valid on the rising edge. // spiInit(); } #endif #ifdef UART_ENABLE_UPDATE void ConfigureUartDevice(void) { // // Enable the the clocks to the UART and GPIO modules. // sciInit(); } #endif #endif /* Note-You need to remove rtiNotification from notification.c to avoid redefinition */ void rtiNotification(rtiBASE_t *rtiREG, uint32 notification) { /* enter user code between the USER CODE BEGIN and USER CODE END. */ uint8_t val1 = gioGetBit(gioPORTB,6); uint8_t val2 = gioGetBit(gioPORTB,7); /* Toggle HET pin 0 */ gioSetBit(gioPORTB,6,(!val1)&1); gioSetBit(gioPORTB,7,(!val2)&1); if(++ms >=100000) ms = 0; } /* USER CODE END */ It appears that I am able to get the interrupt working by modifying as follow the linker file: /* Linker Settings */ --retain="*(.intvecs)" /* USER CODE BEGIN (1) */ /* USER CODE END */ /*----------------------------------------------------------------------------*/ /* Memory Map */ MEMORY { /* USER CODE BEGIN (2) */ /* USER CODE END */ VECTORS (X) : origin=0x00000000 length=0x00000020 vfill = 0xffffffff FLASH0 (RX) : origin=0x00000020 length=0x001FFFE0 vfill = 0xffffffff FLASH1 (RX) : origin=0x00200000 length=0x00200000 vfill = 0xffffffff SRAM (RWX) : origin=0x08002000 length=0x0002D000 STACK (RW) : origin=0x08000000 length=0x00002000 /* USER CODE BEGIN (3) */ /* ECC_VEC (R) : origin=0xf0400000 length=0x4 ECC={algorithm=algoL2R5F021, input_range=VECTORS } ECC_FLA0 (R) : origin=0xf0400000 + 0x4 length=0x3FFFC ECC={algorithm=algoL2R5F021, input_range=FLASH0 } ECC_FLA1 (R) : origin=0xf0440000 length=0x40000 ECC={algorithm=algoL2R5F021, input_range=FLASH1 } */ #if 1 ECC_VEC (R) : origin=(0xf0400000 + (start(VECTORS) >> 3)) length=(size(VECTORS) >> 3) ECC={algorithm=algoL2R5F021, input_range=VECTORS} ECC_FLA0 (R) : origin=(0xf0400000 + (start(FLASH0) >> 3)) length=(size(FLASH0) >> 3) ECC={algorithm=algoL2R5F021, input_range=FLASH0 } ECC_FLA1 (R) : origin=(0xf0400000 + (start(FLASH1) >> 3)) length=(size(FLASH1) >> 3) ECC={algorithm=algoL2R5F021, input_range=FLASH1 } #endif /* USER CODE END */ } /* USER CODE BEGIN (4) */ ECC { algoL2R5F021 : address_mask = 0xfffffff8 /* Address Bits 31:3 */ hamming_mask = R4 /* Use R4/R5 build in Mask */ parity_mask = 0x0c /* Set which ECC bits are Even and Odd parity */ mirroring = F021 /* RM57Lx and TMS570LCx are build in F021 */ } /* USER CODE END */ /*----------------------------------------------------------------------------*/ /* Section Configuration */ SECTIONS { /* USER CODE BEGIN (5) */ /* USER CODE END */ .intvecs : {} > VECTORS /* The toot directory is \Debug */ flashAPI: { .\source\Fapi_UserDefinedFunctions.obj (.text,.data) .\source\bl_flash.obj (.text,.data) --library= "c:\ti\Hercules\F021 Flash API\02.01.01\F021_API_CortexR4_BE_L2FMC.lib" (.text,.data) } palign=8 load = FLASH0 |FLASH1, run = SRAM, LOAD_START(apiLoadStart), RUN_START(apiRunStart), SIZE(apiLoadSize) .text : {} palign=8 > FLASH0 |FLASH1 /*Initialized executable code and constants*/ .const : {} palign=8 > FLASH0 |FLASH1//load=FLASH0 |FLASH1, run = SRAM, LOAD_START(constLoadStart), RUN_START(constRunStart), SIZE(constLoadSize) /*Initialized constant data (e.g. const flash_sectors[..] = )*/ .cinit : {} palign=8 > FLASH0 |FLASH1 /*Initialized global and static variables*/ .pinit : {} palign=8 > FLASH0 |FLASH1 .data : {} > SRAM .bss : {} > SRAM .sysmem : {} > SRAM /* USER CODE BEGIN (6) */ FEE_TEXT_SECTION : {} > FLASH0 | FLASH1 FEE_CONST_SECTION : {} > FLASH0 | FLASH1 FEE_DATA_SECTION : {} > SRAM /* USER CODE END */ } /* USER CODE BEGIN (7) */ /* USER CODE END */ /*----------------------------------------------------------------------------*/ /* Misc */ /* USER CODE BEGIN (8) */ /* USER CODE END */ /*----------------------------------------------------------------------------*/ and commenting this line in the main file: memcpy(&constRunStart, &constLoadStart, (uint32)&constLoadSize); I tried this since for TMS570ls0714 this worked fine and I previosuly had to do it for TMS570LS0914. But I canot understand what is the problem. for reference, I downloaded the exaple bootloader and directly loaded the provided example project in CCS for TMS570LC4357 and only enabled the interrupt (RTI Compare 0) and it caused the same bootloop issue. What could be the cause? is there any issue with my linker file? Thanks

Viewing all articles
Browse latest Browse all 216562

Trending Articles



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