EmbDev.net

Forum: ARM programming with GCC/GNU tools ISR runs out of RAM


von Duy-ky N. (duykyng)


Rate this post
useful
not useful
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

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 ???

Thanks so much,

Duy-Ky

von Martin T. (mthomas) (Moderator)


Rate this post
useful
not useful
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

von Duy-ky N. (duykyng)


Rate this post
useful
not useful
Hi Martin,

1)
I used all your code your code in project named
"at91sam7s64_Atmel_interrupt" for  SAM7S64. I modified to SAM7X256. I
compiled ROM_RUN and used Samba-Boot and SAM-ICE to load into the target
@0x100000, it ran fine, I'm able to see on serial terminal.
I modified AT91SAM7S64-RAM.ld to shift base address from 0 to 0x200000
required by SAM7X256-EK board. I wish to run the whole thing out of RAM.
It doesn't work, nothing appears on serial terminal !?!.

2) user_bin.bin is a data file, not generated from a code, so I'm not
able to get user_bin.o. I'll give it a try the way you mentioned.

I really appreciate your great response.

Best regards,

Duy-Ky

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.