Page 1 of 1

Code Overlays?

Posted: Tue Apr 10, 2012 5:35 pm
by yzoer
Howdy!

I think I asked this a while back on xmoslinkers (RIP) but that's been over a year, so.... Does anyone know if it's possible to:

a) Specify an absolute address for your code?
b) If it's possible to dynamically load code to said absolute address.

Naturally, there wouldn't be any information for the linker but that's ok. All I'm looking for is to load code at an address and execute it. Should in theory be possible but figured I'd ask if anyone here has (successfully) done this...

-Yvo

Re: Code Overlays?

Posted: Tue Apr 10, 2012 5:43 pm
by XMatt
The XTAG-2 bootloader does this, it runs at location 0x1b000 allowing it to dynamically load the JTAG firmware at runtime into address 0x10000 and jump to it. The options to the tools to do this can be seen in this makefile https://github.com/xcore/proj_xtag2/blo ... r/Makefile and the code for the loader is in https://github.com/xcore/proj_xtag2/tre ... loader/src ... just to note when booting from flash or OTP the code will only be copied to address 0x10000, the XTAG-2 bootloader code is wrapped in a small relocating loader which moves it after boot to 0x1b000 and then executes.

Re: Code Overlays?

Posted: Tue Apr 10, 2012 6:14 pm
by yzoer
Good to know! Thanks!

-Yvo

Re: Code Overlays?

Posted: Wed Apr 18, 2012 6:58 pm
by yzoer
Just to follow up, so if the OTP loads code directly to 0x10000, is there anyway to:

a) compile XE's to any absolute address (i.e. 0x12000 or 8k after the OTP)
b) is there any public code available to initialize constructors, bss, data, etc?

This would allow you to write a front-end / loader in OTP that in turn loads (potentially multiple) executables to the area behind the OTP bootloader...

Thanks!

Yvo

Re: Code Overlays?

Posted: Tue May 29, 2012 7:04 pm
by yzoer
In case anyone's interested, I ask about this about uhm, 3 years ago and managed to dig up some more info from xlinkers...

http://www.xmos.com/discuss/viewtopic.php?f=3&t=459