04-28-2016 03:54 AM
I'm trying to prove that I can run two (or more) Bare-metal applications or elf files from a single Boot.bin without U-boot/Linux.
I want to run these applications consecutively on one processor. The Boot.bin file is as follows:
At first FSBL was overwriting Hello_World with Goodbye_world but I (Kind of) fixed this by editing the linker script files (lscript.ld). You'd think there would be a warning of some kind when two applications share the same address. Perhaps it was the order I created the Apps?
The question I have is the hand-off process from one application to the next, FSBL does this with assembly and with my un-trained software eye it looks like a "goto" statement. Do i need my Hello_world application use this (forbidden) command, or is there another (hopefully easier) way?
04-28-2016 09:37 AM
Bootloaders are generally non-returning. This means that they also cannot boot multiple softwares. If you also want your Hello_world to be non-returning then you can do the same handoff technique to the next elf. Goto is simply sometimes the right tool for the job.
If you wanted the return to Hello_world.elf after Goodbye_world, then you would need to have Goodbye_world's entry point follow the calling convention and return. Then hello_world would be able to do the handoff as a function call.
The goto things is probably easier.
05-04-2016 08:59 AM
Thanks for the reply,
I had to bite the bullet and use a goto command which worked. I was able to jump from Application/elf to Application/elf. I was even able to jump back to fsbl (0x0000_0000). This worked great until I began adding code to the Goodbye_world.elf. The Start Address shifted!
I spent two days searching FSBL for some sort of algorithm that changes the start address (Like a size dependency or something). It turns out it was the .elf itself during a build!
I spilt my DDR memory in lscript.ld into 0x0010_0000 to 0x0FF0_0000 for Hello_world and 0x0FF0_0001 to 0x1FF0_0000 for Goodbye_world. Initialy 0x0FF0_0004 was the start address, as long as the start address was in 0x4 block multiple it would work (Start Address: 0x0FF0_0004 or 0x0FF0_0008 or 0x0FF0_000C...) when I began adding code to Goodbye_world the block range went up to 0x40. (Address: 0x0FF0_0040 or 0x0FF0_0080 or 0x0FF0_00C0).
I'm still not entirely sure why the address range increased from 0x4 to 0x40 but I believe it’s something to do with RAM block size....maybe.
03-08-2017 04:25 AM
03-10-2017 03:04 AM
its been almost a year since I gave up on a standalone design and moved on to an Linux design, but I do remember you need to partition your apps and "fiddle" with the lscript.ld file's Stack/Heap size and make sure the memory regions don't overlap. Sorry I cant provide anymore help.