I am trying to build an app to launch from ROM, but run all but my startup code from RAM. There is no example like this included with embOS. IAR has an app note that suggests that is easy to do in 5.40.2 and later. Sadly, the linker tries to be a little too "smart" and this causes some problems. The problem is that the linker makes a decision about what code is needed for startup, and then no matter what, that code is not located in RAM. There seems to not be any way to locate it in RAM and have it get copied by the IAR startup process. Something is causing the linker to want to place everything from rtosinit into ROM. So for example, the interrupt handlers get located in ROM and the system fails badly on the first system clock tick if ROM is not available. It would appear from the IAR docs, and my tracing the ASM through to the call to main, that everything from main and later should be copied to RAM. Without the source package I don't have much visibility into the reason why this is not happening. Does anyone have some insight into this, if not actual knowledge of why it happens and how to work around ?
Any suggestions will be much appreciated.
George
PS - I just copied the demo application Start_AT91SAM7S256 provided with embOS 3.82b and added "readonly" to the initialize by copy line. It becomes "initialize by copy (readonly, readwrite)". This is sufficient to demonstrate the problem. After building, the map file shows many important runtime functions in ROM. For example, OS_irq_handler(), OS_Error(), and OS_Idle().
Any suggestions will be much appreciated.
George
PS - I just copied the demo application Start_AT91SAM7S256 provided with embOS 3.82b and added "readonly" to the initialize by copy line. It becomes "initialize by copy (readonly, readwrite)". This is sufficient to demonstrate the problem. After building, the map file shows many important runtime functions in ROM. For example, OS_irq_handler(), OS_Error(), and OS_Idle().
The post was edited 1 time, last by gpontis ().