[Jan 06] Arch Linux (20171225-1) PINE A64(+) Pinebook A64-LTS/SOPINE | [Jan 04] Linux (0.5.15-136) ROCK64 | [Jan 04] Android (20171204) ROCK64 | [Dec 22] Stretch Mate (0.5.15-136-20171222) ROCK64 | [Dec 21] openHAB 2 (v1.4) PINE A64(+) | [Dec 11] Volumio (2.315) PINE A64(+) A64-LTS/SOPINE | [Dec 11] Armbian (5.35) PINE A64(+) Pinebook A64-LTS/SOPINE | [Dec 8] OpenMediaVault (0.5.15-136) ROCK64

Getting Started | Visit the WIKI | IRC Logs | Forum Rules/Policy


Padi bootloader info
#1
Hi,
I'm trying to develop a minimal application made by a "main" while loop. I've followed the Makefile shipped with the SDK sample application, but did not bring in all of the sw libraries that are linked in in the original sample sdk app.

The resulting binary is correctly flashed onto padi, but when I debug the application with gdb, after the "monitor reset 0" I'm not able to reach the main() code.
If I do force the program counter with "set $pc = main" I manage to run the proper code.

I've properly stripped the ram_1.r.bin sections into an object file

Code:
arm-none-eabi-objcopy --rename-section .data=.loader.data,contents,alloc,load,readonly,data
-I binary -O elf32-littlearm -B arm tools/bootloader//ram_1.r.bin build/bootloader.o


and linked such objfile `bootloader.o` in:

Code:
arm-none-eabi-g++ -mcpu=cortex-m3 -mthumb -g --specs=nano.specs -nostartfiles -O0
-ffunction-sections -fdata-sections -std=c++11 -fno-use-cxa-atexit
-L../sdk/component/soc/realtek/8195a/misc/bsp/lib/common/GCC/ -L./env/
-L./arm-none-eabi/lib/thumb/ -nostdlib -nodefaultlibs -nostartfiles -Wl,--cref
-Wl,-Map=build/binary.map -Wl,--entry=Reset_Handler -l_wlan -l_p2p -l_wps -l_rtlstd
-l_websocket -l_xmodem -T rlx8195A-symbol-v02-img2.ld -o build/app.axf
build/main.o build/bootloader.o -lstdc++ -lm -lgcc -lc -lnosys

I've objcopied sections of the image_2 text area stuff as in the sample app into a binary file

Code:
arm-none-eabi-objcopy -j .image2.start.table  -j .ram_image2.text  -j .ram_image2.rodata  -j .ram.data
-Obinary build/app.axf build/app.bin

And I've "picked" the text and sdram image stuff with IAR pick tool (still don't understand what its role is):

Code:
tools/iar_utils/pick "0x"`grep __ram_image2_text_start__ build/app.nmap | cut -f 1 -d " "` \
        "0x"`grep __ram_image2_text_end__ build/app.nmap | cut -f 1 -d " "` \
        build/app.bin build/app.text.bin body+reset_offset+sig > /dev/null
tools/iar_utils/pick "0x"`grep __sdram_data_start__ build/app.nmap | cut -f 1 -d " "` \
        "0x"`grep __sdram_data_end__ build/app.nmap | cut -f 1 -d " "` \
        build/sdram.bin build/sdram.data.bin body+reset_offset > /dev/null

I've then padded the "ram_1.p.bin" image with "padding" tool:

Code:
tools/iar_utils/padding 44k 0xFF tools/bootloader//ram_1.p.bin > /dev/null

and set the RamFileSize:

Code:
echo 'set $RamFileSize = '`du -b build/img.bin |cut -f1 -d 'b'` > build/fwsize.gdb

And finally I've concatenated the various outputs as in sample Makefile app

Code:
cat build/ram_1.p.bin > build/img.bin
cat build/app.text.bin >> build/img.bin
cat build/sdram.data.bin >> build/img.bin


Still I cannot get to run the main code. I've tried to disassemble and gdb debug the sample app and mine, and can observe that the "main" is invoked from an "_AppStart" routine called from some place in ram_1.p.bin or ram_1.r.bin, I believe.

My question:
what is the key point where "main" is actually invoked? What happens before main and what am I skipping/doing wrong?
Moreover, what about ctors and dtors global vars etc..? I've seen the bneq loop of the bss zone clean up, but can't get the whole picture right.

The obscure parts are, I think


ram_1.r.bin
ram_1.p.bin

What do they do exactly?

Also, I'd like some clarification of the role of the following files

target_NORMAL.axf
target_NORMALB.axf
target_NORMALC.axf


Thanks in advance
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  Arduino board package for PADI IoT Stamp lapse 6 2,186 06-09-2017, 06:07 AM
Last Post: thomash
  VGA Driver for PADI IoT Stamp kissste 1 807 12-15-2016, 10:46 AM
Last Post: tllim

Forum Jump:


Users browsing this thread: 1 Guest(s)