Duy-ky Nguyen wrote:
> Hi,
>
> I need to process User binary file stored in Flash.
> In trying many algorithm, I need to run interrupt UART out of RAM.
> I have 2 problems
>
> 1) Unable to run ISR out of RAM
> I modified "at91sam7s64_Atmel_interrupt_20060825.zip" for AT91SAM7X256.
> Using raw binnary execute file, NOT ELF, it runs fine out of ROM using
> AT91SAM7S64-ROM.ld, but not out of RAM using AT91SAM7S64-RAM.ld.
>
> Q?? : How to run ISR out of RAM
Did you verify that the ISR has a VMA in the RAM-addresse-range? The RAM
linker-scripts in most(all?) of my examples are ment to create a
binary-code placed completly in RAM for debugging (upload image into RAM
thru debugger, remap exception vectors and "go" from RAM-address). If
you need only some functions (like your ISR) in RAM you have to assign a
special c-section (attribute section), add this section in the
linker-script and make sure the section is copied from LMA to VMA during
startup. Some of my examples demonstrate this (search ramfunc or
fastrun). It might be a good idea to place the exceptions-vectors (copy
& remap) and ISR-wrapper (if any) in RAM too.
> 2) Unable to include User binary file into linker script
> If I have to run out of ROM, I need to embed the User binary into the
> Main execute file. I try to use linker script, add something like
>
> ...
> User_bin 0x12e000 : {user_bin.bin }
> ...
>
> It complains about wrong format.
>
> Q?? : How to convert a raw binary to a correct format for linker, using
> objcopy ???
IRC you need to convert the binary file to an object file for linking.
The following method has been described by Jörg Wunsch in an AVR forum.
I have never tested it for ARM but you may give it a try:
- arm-elf-objcopy -I binary -O elf32-littlearm user_bin.bin user_bin.o
- add user_bin.o to the linked objects
- "Array"-access: extern void *_binary_user_bin_bin_start;
- size: extern size_t _binary_user_bin_bin_size;
I'm not sure about the names but the symbol-table for map-file should
provide information about the used "mangling".
For absolute placement in the linker-script you may just try user_bin.o
instead of user_bin.bin.
Martin Thomas