This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi All,
I m using TMS570LS0914 for one of the application. I m facing an issue during the startup code which is as follow;
I tried to change the start address of the application In the linker file from 0x00000000 to 0x00020000.
MEMORY
{
VECTORS (X) : origin=0x00020000 length=0x00000020
FLASH0 (RX) : origin=0x00020020 length=0x000DFFE0
STACKS (RW) : origin=0x08000000 length=0x00001500
RAM (RW) : origin=0x08001500 length=0x0001EB00
/* USER CODE BEGIN (2) */
/* USER CODE END */
}
When we try to run the application the Debug mode, the code getting struck in startup code(either in ESM failure(infinity for loop) or the stack pointer pointing to undefined memory location(0x00000004)).
The code is generated using Halocogen v4.7.1, where the startup code consist of all the self-test sequence.
But while testing when we kept the VECTOR start address as 0x00000000 and the FLASH0 address at 0x00020000, the application working fine.
Do I miss any configurations?
Hi,
The thing is that vector table MUST be at the address 0x00000000, because that's where the CPU loads instructions from when starting or getting interrupt.
First instruction that is executed is located at the address 0x00000000 and it's a branch instruction to reset interrupt handler.
So, if you change linker script as above you will get undefined behavior, as you stated above.
Best regards,
Marko
hi Marko,
My bootloader code will reside from 0x00000000 to 0xXXXXXXXX, then my application code starts from 0x00020000. The issue here is if I try to debug the application code which is starts at the address 0x00020000 it is failing in the startup code, where sometimes RAM ECC uncorrectable error rising and sometimes the SP points to undef entry location.
The interrupt vector start address can be changeable I guess.
Regards,
Saravanan
Hi,
I'm doing exactly the same thing.
You don't need vector table for firmware (application).
My bootloader linker script:
/*----------------------------------------------------------------------------*/ /* Linker Settings */ --retain="*(.intvecs)" /* USER CODE BEGIN (1) */ --entry_point=__mutters_int00 -iF021/ /* USER CODE END */ /*----------------------------------------------------------------------------*/ /* Memory Map */ /*----------------------------------------------------------------------------*/ /* Linker Settings */ --retain="*(.intvecs)" /* USER CODE BEGIN (1) */ --entry_point=__mutters_int00 -iF021/ /* USER CODE END */ /*----------------------------------------------------------------------------*/ /* Memory Map */ MEMORY { /* USER CODE BEGIN (2) */ /* USER CODE END */ VECTORS (X) : origin=0x00000000 length=0x00000020 FLASH0 (RX) : origin=0x00000020 length=0x001FFFE0 FLASH1 (RX) : origin=0x00200000 length=0x00200000 STACKS (RW) : origin=0x08000000 length=0x00001500 RAM (RW) : origin=0x08001500 length=0x0007EB00 /* USER CODE BEGIN (3) */ /* USER CODE END */ } /* USER CODE BEGIN (4) */ /* USER CODE END */ /*----------------------------------------------------------------------------*/ /* Section Configuration */ SECTIONS { /* USER CODE BEGIN (5) */ .mutt_flash align(32) : { --library= F021_API_CortexR4_BE_V3D16.lib (.text) } LOAD > FLASH0 , RUN > RAM , LOAD_START ( __mutt_flash_start ) , LOAD_END ( __mutt_flash_end ) , RUN_START ( __mutt_flash_run_start ) /* USER CODE END */ .intvecs : {} > VECTORS .text align(32) : {} > FLASH0 | FLASH1 .const align(32) : {} > FLASH0 | FLASH1 .cinit align(32) : {} > FLASH0 | FLASH1 .pinit align(32) : {} > FLASH0 | FLASH1 .bss : {} > RAM .data : {} > RAM .sysmem : {} > RAM /* USER CODE BEGIN (6) */ /* USER CODE END */ } /* USER CODE BEGIN (7) */ /* USER CODE END */ /*----------------------------------------------------------------------------*/ /* Misc */ /* USER CODE BEGIN (8) */ /* USER CODE END */ /*----------------------------------------------------------------------------*/
My firmware linker script:
/*----------------------------------------------------------------------------*/ /* Linker Settings */ --retain="*(.intvecs)" /* USER CODE BEGIN (1) */ --entry_point=fw_main /* USER CODE END */ /*----------------------------------------------------------------------------*/ /* Memory Map */ MEMORY { /* USER CODE BEGIN (2) */ /* USER CODE END */ FLASH0 (RX) : origin=0x00010000 length=0x001EFFE0 FLASH1 (RX) : origin=0x00200000 length=0x00200000 STACKS (RW) : origin=0x08000000 length=0x00001500 RAM (RW) : origin=0x08001500 length=0x0007EB00 /* USER CODE BEGIN (3) */ /* USER CODE END */ } /* USER CODE BEGIN (4) */ /* USER CODE END */ /*----------------------------------------------------------------------------*/ /* Section Configuration */ SECTIONS { /* USER CODE BEGIN (5) */ .mutters_init align(32) : {} > 0x10000 /* USER CODE END */ .text align(32) : {} > FLASH0 .const align(32) : {} > FLASH0 .cinit align(32) : {} > FLASH0 .pinit align(32) : {} > FLASH0 .bss : {} > RAM .data : {} > RAM .sysmem : {} > RAM FEE_TEXT_SECTION : {} > FLASH0 FEE_CONST_SECTION : {} > FLASH0 FEE_DATA_SECTION : {} > RAM /* USER CODE BEGIN (6) */ /* USER CODE END */ } /* USER CODE BEGIN (7) */ /* USER CODE END */ /*----------------------------------------------------------------------------*/ /* Misc */ /* USER CODE BEGIN (8) */ /* USER CODE END */ /*----------------------------------------------------------------------------*/
As you can see, in FW linker script .intvecs section is removed and I don't need interrupt vectors for FW code.
Bootloader is responsible to handle interrupts, not FW. You can implement some callback mechanism where bootloader will call FW handlers.
Best regards,
Marko