How to load ELF image build by Arduino using Non-OS SDK bootloader

gailu
Posts: 47
Joined: Fri May 29, 2015 2:03 pm

How to load ELF image build by Arduino using Non-OS SDK bootloader

Postby gailu » Tue Jun 01, 2021 2:07 pm

Hi Espressif Team,

I have a requirement where I need to use elf image built using Arduino IDE but with boot_v1.6.bin provided in the NonOS SDK. I performed following steps

Background:
1. Arduino builds 2 elf files (sketch elf file and eboot elf file) then uses elf2bin.py (https://github.com/esp8266/Arduino/blob ... elf2bin.py) to stitch single binary that can be flashed on address 0x0. As we want to use SDK boot loader so we skipped eboot.elf file. and used only sketch elf file to follow NONOS SDK process to create a bin file.

My Sketch Elf File Name: hello.ino.elf

Step 1: Run objcopy command to generate following files as per Make file rules

Code: Select all

xtensa-lx106-elf-objcopy.exe --only-section .text -O binary hello.ino.elf eagle.app.v6.text.bin
xtensa-lx106-elf-objcopy.exe --only-section .data -O binary hello.ino.elf eagle.app.v6.data.bin
xtensa-lx106-elf-objcopy.exe --only-section .rodata -O binary hello.ino.elf eagle.app.v6.rodata.bin
xtensa-lx106-elf-objcopy.exe --only-section .irom0.text -O binary hello.ino.elf eagle.app.v6.irom0text.bin


Step2: Run gen_appbin.py to create binary file eagle.app.flash.bin

Code: Select all

tools\gen_appbin.py hello.ino.elf 1 2 0 4 1


Step3: Flashed following binaries on ESP12 F using ESP Download Tool

Code: Select all

boot_v1.6.bin:             0x00000;
eagle.app.flash.bin:       0x01000;
esp_init_data_default.bin: 0x3FC000;
blank.bin:                 0x3FE000;


Run the board. But it did not work (no output on console except for some junk). As the sketch is nothing but a C++ code, I believe it should have worked. Can you please guide me.

I am attaching source File, elf file and linker script used to create elf file for sketch.
Attachments
files.zip
Elf File and Linker scripts
(742.07 KiB) Downloaded 11 times

gailu
Posts: 47
Joined: Fri May 29, 2015 2:03 pm

Re: How to load ELF image build by Arduino using Non-OS SDK bootloader

Postby gailu » Tue Jun 01, 2021 9:26 pm

I see one major difference in the linker script between SDK and Arduino. In case of nonos SDK, IRAM has only one segment (.text) whereas Arduino splits IRAM in to two segment .text and .text1.

Do I need to do objcopy for .text1 as I am doing for .text segment? If Yes, How to I use it in gen_appbin.py, does that script need to be updated?

gailu
Posts: 47
Joined: Fri May 29, 2015 2:03 pm

Re: How to load ELF image build by Arduino using Non-OS SDK bootloader

Postby gailu » Tue Jun 01, 2021 10:01 pm

I now changed objcopy command to include both sections (.text and .text1) as follows

from

Code: Select all

xtensa-lx106-elf-objcopy.exe --only-section .text -O binary hello.ino.elf eagle.app.v6.text.bin

to

Code: Select all

xtensa-lx106-elf-objcopy.exe --only-section .text* -O binary hello.ino.elf eagle.app.v6.text.bin


But still no success. From Theoretical point of view it should work but I believe something else is also missing.

Any pointer will help to get it working

gailu
Posts: 47
Joined: Fri May 29, 2015 2:03 pm

Re: How to load ELF image build by Arduino using Non-OS SDK bootloader

Postby gailu » Wed Jun 02, 2021 7:54 pm

Hi ESP_Faye, ESP_wujiangang and ESP_Deng Xin

Any idea why standard bootloader provided in SDK can not boot an elf file converted to bin file with the standard nonos sdk procedure?

Where is the limitation?

Her Mary
Posts: 513
Joined: Mon Oct 27, 2014 11:09 am

Re: How to load ELF image build by Arduino using Non-OS SDK bootloader

Postby Her Mary » Thu Jun 03, 2021 11:36 am

I thought nonOS was kind of EoF.. Not sure.. Could this help? https://github.com/espressif/ESP8266_NO ... r/Makefile

gailu
Posts: 47
Joined: Fri May 29, 2015 2:03 pm

Re: How to load ELF image build by Arduino using Non-OS SDK bootloader

Postby gailu » Thu Jun 03, 2021 7:39 pm

Thanks, I sorted it out

talleychan
Posts: 2
Joined: Sat Jun 12, 2021 12:40 pm

Re: How to load ELF image build by Arduino using Non-OS SDK bootloader

Postby talleychan » Sat Jun 12, 2021 12:49 pm

I see one significant difference between the SDK and Arduino linker scripts. IRAM contains just one segment (.text) in the nonos SDK, whereas Arduino splits IRAM into two segments. 1. text and. text
Thank!

Who is online

Users browsing this forum: No registered users and 16 guests