Hi,

 

When poking around some startup files I have found interesting place related to RAM_VECTORS support

 

CMSIS have __PROGRAM_START macro which is different for each compiler.

For GCC it uses  __cmsis_start, for ARMClang - __main and for IAR - __iar_program_start

 

Basically each of the functions should copy several sections (.TFM_DATA for example) from FLASH to RAM and zero out some parts of RAM (for .TFM_BSS for example)

 

In current implementation GCC __cmsis_start function also copies the vector table from FLASH to SRAM (if RAM_VECTORS are enabled)

But ARMClang and IAR equivalents  of that function (__main, __iar_program_start) does not seem to take care of copying vector table, so platforms startup should do that

 

I wonder if there is a way to change linker script in a way which will make copying of vector table automatic (by compiler dependent function).

This will make platform startups a bit cleaner and will allow platform to just use __PROGRAM_START macro without any additional code to copy vector table.

 

From what I see IAR has “initialize by copy” syntaxis so I think it may be used to tell IAR to automatically copy vector table.

It is a bit more tricky with ARMClang as I have not found a way to do that there.

 

I am not a big expert in ARMClang and IAR so maybe someone may help me here, give some directions or confirm that currently there is no way to make this idea work.

 

Basically the intention is to simplify platform startup code and offload common operations to compiler specific platform independent functions.

 

Regards,

Bohdan Hunko

 

Cypress Semiconductor Ukraine

Engineer

CSUKR CSS ICW SW FW

Mobile: +38099 50 19 714
Bohdan.Hunko@infineon.com