Closed kiralikbeyin closed 5 years ago
Yes. If you are using a >1mb flash (and big flash mode) you can link a single version of your app and use it at the same relative location in each 1mb block of flash (0x002000, 0x102000, 0x202000, etc). If you are putting two roms in the same 1mb of flash (e.g. if you only have 1mb) then you need to link two different versions of the application, one for the low position and one for the higher position.
See https://github.com/raburton/rboot-sample for an example, note the two .ld files and the difference between them: irom0_0_seg : org = 0x40202010, len = 0x3C000 irom0_0_seg : org = 0x40282010, len = 0x3C000
rboot-stage2a.ld https://github.com/raburton/rboot/blob/master/rboot-stage2a.ld
MEMORY
{
dport0_0_seg : org = 0x3FF00000, len = 0x10
dram0_0_seg : org = 0x3FFE8000, len = 0x14000
iram1_0_seg : org = 0x4010FC00, len = 0x400
irom0_0_seg : org = 0x40282010, len = 0x3C000
}
iram1_0_seg is different in rboot lib,
sample have iram1_0_seg : org = 0x40100000, len = 0x8000
in both rom0.ld and rom1.ld
rboot have _iram1_0_seg : org = 0x4010FC00, len = 0x400
Also i didnt understand len = 0x3C000 my real binary will be 670k for rom0 and 260k for rom1 do i have to change 0x3C000 ? (My test blink files are only 255k)
Note that eagle.rom.addr.v6.ld file has extra rows in sample: PROVIDE ( Enable_QMode = 0x400044c0 );
PROVIDE ( Td0 = 0x3fffd100 ); PROVIDE ( Td4s = 0x3fffd500); PROVIDE ( rcons = 0x3fffd0f0); Do i have to add these also?
eagle.app.v6.ld file is now
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 = 0x40202010, len = 0x3C000
}
rboot-stage2a.ld changed iram1_0_seg:
MEMORY
{
dport0_0_seg : org = 0x3FF00000, len = 0x10
dram0_0_seg : org = 0x3FFE8000, len = 0x14000
iram1_0_seg : org = 0x4010FC00, len = 0x400
irom0_0_seg : org = 0x40282010, len = 0x3C000
}
Stops at as before Booting rom 1 at 82000, load addr b86a0. //STOPS HERE BUT NODEMCU CONTINUE TO ROM 0
rboot-stage2a.ld changed iram1_0_seg didnt make any boot :
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 = 0x40282010, len = 0x3C000
}
@raburton i am changing eagle.rom.addr.v6.ld -rboot-stage2a.ld -eagle.app.v6.ld files but there is a folder : https://github.com/SuperHouse/esp-open-rtos/tree/master/ld Does it need action?
I copied rboot-sample files to rboot https://github.com/raburton/rboot-sample/blob/master/eagle.rom.addr.v6.ld to https://github.com/raburton/rboot/blob/master/eagle.rom.addr.v6.ld
https://raw.githubusercontent.com/raburton/rboot-sample/master/rom0.ld to https://github.com/raburton/rboot/blob/master/eagle.app.v6.ld
https://raw.githubusercontent.com/raburton/rboot-sample/master/rom1.ld to https://github.com/raburton/rboot/blob/master/eagle.app.v6.ld
and maked irom0_0_seg len = 0x3C000 to len = 0x50000
didnt make any boot ..
rboot-stage2a.ld https://github.com/raburton/rboot/blob/master/rboot-stage2a.ld
You don't need to change any of the rBoot ld files (such as rboot-stage2a.ld), in fact you should not be touching these at all.
You need to change the ld files you use to link your own application. You normally only have one of these, but you need a second one with a different irom0_0_seg org address. See the example in rboot-sample. Then you need to link your application twice, once with each of these lib files, and flash the correct one to the correct half of the flash.
I copied rboot-sample files to rboot
Why did you do that? rboot repo contains the rBoot boot loader, rboot-sample is a demo user application that can be run with rBoot that demonstrates OTA. You need to build both, separately, not randomly copy files from one to the other. I suggest you read the instructions in each repository and build them to get rBoot and the sample application running before you try using it with your own application. That way you will hopefully gain some understanding of what is actually happening in the boot process. You might also want to read the explanatory entries in my blog.
I understand it now! i made a duplicate of this ld file https://github.com/SuperHouse/esp-open-rtos/blob/master/ld/program.ld and i only changed
irom0_0_seg : org = 0x40202010, len = 0x50000 irom0_0_seg : org = 0x40282010, len = 0x50000
add parameters.mk
ifdef r1
LINKER_SCRIPTS += $(ROOT)ld/rom.ld $(ROOT)ld/pr1.ld
endif
ifdef r2
LINKER_SCRIPTS += $(ROOT)ld/rom.ld $(ROOT)ld/pr2.ld
endif
#LINKER_SCRIPTS += $(ROOT)ld/program.ld $(ROOT)ld/rom.ld
prepare bins make r1=1 for blink1 app make r2=1 for blink2 app
flash it esptool.py -p /dev/cu.wchusbserial1410 --baud 115200 write_flash -fs 1MB -fm dout -ff 40m \ 0x0 ../../bootloader/firmware/rboot.bin 0x2000 ./firmware/blink.bin 0x82000 ../../bootloader/firmware_prebuilt/blink.bin
thank you @raburton
Now i will try this: rom0 670k bin rom1 250k OTA updater bin
I have 2 simple blink app which switches roms.
Nodemcu works fine but same blink apps dont work on esp01 or sonoff dualr2
flash for 32m (4MB) with qio - blink 2 is on 0x202000
flash for 8m (1MB) with dout - blink 2 is on 0x82000
blink 1
blink 2
Is there a special file (eagle.rom.addr.v6.ld -rboot-stage2a.ld -eagle.app.v6.ld) for 1MB ?