Other Parts Discussed in Thread: HALCOGEN, TLK111, DP83640
Tool/software:
Hi,
I am currently working on a bootloader which resides at 0x00000000. The bootloader code was generated by halcogen and all it does is to call the function at 0x00200000 from it's main function using a function pointer. At 0x00200000, I manually places blinky binary which is acting like an application code. The blinky code is compiled as per the linker script below and so the exception vectors of the blinky code are at 0x00200000.
The idea here is when the processor starts at 0x00000000, it completes the intialization and in main function of the bootloader, it jumps to the reset vector of blinky code at 0x00200000. The branch instruction at 0x00200000 then branches to _c_int00 of blinky and reinitialize everything again and then executes it's main.
I am able to get it to jump from bootloader to blinky's reset handler and then start the initialization. However, the code gets into prefetch abort while it is in blinky's _TI_auto_init() function (specifically in run_cinit). Could someone tell me if I am missing something here. Is _TI_auto_init (or run_cinit) function not location independent?
Blinky code linker script is as below:
/*----------------------------------------------------------------------------*/
/* 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
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) */
/* 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 */
/*----------------------------------------------------------------------------*/