Running from IROM?
Posted: Wed Jul 15, 2015 8:57 am
Hello,
I have a problem with a project big enough not to fit in iROM.
I've compiled all the files using xtensa's gcc/g++ to objects, then tried linked them. I am using these memory map options:
It didn't work sadly, as .text section was too big to fit in irom, as ld told me. To remedy that, I have found on the google I should move .text section and .literal to irom, which according to the above memory map is much, much bigger. I did so by moving
line in linker script from .text to .irom0.text.
Everything compiled nice this time and I've got an elf file. I converted everything to .bin files, using esptool.py and got two bin files: one starting at 0x00000 and one starting at 0x01010. While uploading the first one worked fine, second one couldn't be uploaded (exception: failed to enter flash download mode) which indicated bad starting address. I have changed memory map in linker script to:
Everything compiled fine once again, i elf2bin'd elf file again, this time, as expected, I've got 0x00000 and 0x40000 addresses, which I could upload this time. Everything seemed fine expect...
It doesn't work
I've reduced the setup function to setting up Serial at 9600 and loop to writing something at it, so it should be extremely easy to see it works, but it doesn't nothing shows up on serial monitor.
To me it seems like the program is not even starting, as I dont think I have notified ESP where the program starts or something like that. But I am quite new to this, so I may be missing or forgetting something.
In short, what I've done:
1. Compile files to .a
2. Link them together with libraries
3. esptool.py elf2bin
4. esptool.py write_flash
Any help would be appreciated!
Edit: If it may help, I am using ESP8266 Arduino libraries, but I'm not using its IDE. This is important, because I am porting an already-existing Arduino project to ESP8266.
Analyzing eagle.rom.addr.v6.ld, it looks like there are defined some addresses of functions, like the one named __start looks like beginning of the program. Maybe these only apply to the provided sdk library and not to mine? (Im guessing, because I have no idea what I am doing). Is this correlated to this issue?
Alternatively, how to run a program bigger than 64kB (I think that is the size of IRAM?) without moving everything to irom? Is it even possible?
I have a problem with a project big enough not to fit in iROM.
I've compiled all the files using xtensa's gcc/g++ to objects, then tried linked them. I am using these memory map options:
Code: Select all
MEMORY
{
dport0_0_seg : org = 0x3FF00000, len = 0x10
dram0_0_seg : org = 0x3FFE8000, len = 0x14000
iram1_0_seg : org = 0x40100000, len = 0x8000
irom0_0_seg : org = 0x40201010, len = 0x69ff0
}
It didn't work sadly, as .text section was too big to fit in irom, as ld told me. To remedy that, I have found on the google I should move .text section and .literal to irom, which according to the above memory map is much, much bigger. I did so by moving
Code: Select all
*(.literal .text .literal.* .text.* .stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)
line in linker script from .text to .irom0.text.
Everything compiled nice this time and I've got an elf file. I converted everything to .bin files, using esptool.py and got two bin files: one starting at 0x00000 and one starting at 0x01010. While uploading the first one worked fine, second one couldn't be uploaded (exception: failed to enter flash download mode) which indicated bad starting address. I have changed memory map in linker script to:
Code: Select all
MEMORY
{
dport0_0_seg : org = 0x3FF00000, len = 0x10
dram0_0_seg : org = 0x3FFE8000, len = 0x14000
iram1_0_seg : org = 0x40100000, len = 0x8000
irom0_0_seg : org = 0x40240000, len = 0x69ff0
}
Everything compiled fine once again, i elf2bin'd elf file again, this time, as expected, I've got 0x00000 and 0x40000 addresses, which I could upload this time. Everything seemed fine expect...
It doesn't work
I've reduced the setup function to setting up Serial at 9600 and loop to writing something at it, so it should be extremely easy to see it works, but it doesn't nothing shows up on serial monitor.
To me it seems like the program is not even starting, as I dont think I have notified ESP where the program starts or something like that. But I am quite new to this, so I may be missing or forgetting something.
In short, what I've done:
1. Compile files to .a
2. Link them together with libraries
3. esptool.py elf2bin
4. esptool.py write_flash
Any help would be appreciated!
Edit: If it may help, I am using ESP8266 Arduino libraries, but I'm not using its IDE. This is important, because I am porting an already-existing Arduino project to ESP8266.
Analyzing eagle.rom.addr.v6.ld, it looks like there are defined some addresses of functions, like the one named __start looks like beginning of the program. Maybe these only apply to the provided sdk library and not to mine? (Im guessing, because I have no idea what I am doing). Is this correlated to this issue?
Alternatively, how to run a program bigger than 64kB (I think that is the size of IRAM?) without moving everything to irom? Is it even possible?