Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stuck after "Waiting for Fernly USB loader banner..." #40

Open
heeplr opened this issue Jan 15, 2025 · 0 comments
Open

Stuck after "Waiting for Fernly USB loader banner..." #40

heeplr opened this issue Jan 15, 2025 · 0 comments

Comments

@heeplr
Copy link

heeplr commented Jan 15, 2025

Thanks for this awesome project!

I'm trying to get fernly running on one of those ultra cheap & tiny GF-07 GPS trackers:

$ ./build/fernly-usb-loader -w -s /dev/fernvale ./build/usb-loader.bin ./build/firmware.bin                                                    08:48:14 [0/1940]
Waiting for serial port to connect: .....                                                                                                                                                                            
Setting serial port parameters... Ok                                                                                                                                                                                 
Initiating communication... Ok                                                                                                                                                                                       
Getting hardware version... 0xcb00                                                                                                                                                                                   
Getting chip ID... 0x6260                                                                                                                                                                                            
Getting boot config (low)... 0x0000                                                                                                                                                                                  
Getting boot config (high)... 0x0000                                                                                                                                                                                 
Getting hardware subcode... 0x8000                                                                                                                                                                                   
Getting hardware version (again)... 0xcb00                                                                                                                                                                           
Getting chip firmware version... 0x0000                                                                                                                                                                              
Getting security version... v 5           
Enabling security (?!)... Ok              
Reading ME... 00000000 4f 3e 54 6a 0c 9c 29 c6  f1 39 0e 42 e6 f4 1b 97  |O>Tj..)..9.B....|
Disabling WDT... Ok                    
Reading RTC Baseband Power Up (0xa0710000)... 0x0006                                                      
Reading RTC Power Key 1 (0xa0710050)... 0xfff7                                                            
Reading RTC Power Key 2 (0xa0710054)... 0xffff                                                            
Setting seconds... Ok                               
Disabling alarm IRQs... Ok                                                                                
Disabling RTC IRQ interval... Ok              
Enabling transfers from core to RTC... Ok           
Reading RTC Baseband Power Up (0xa0710000)... 0x0006
Getting security configuration... None.       
Getting PSRAM mapping... 0x0000                     
Disabling PSRAM -> ROM remapping... Ok              
Checking PSRAM mapping... 0x0002                    
Checking on PSRAM mapping again... 0x0002
Updating PSRAM mapping again for some reason... Ok  
Reading some fuses... 0x00000000         
Enabling UART... 0x0000                           
Loading Fernly USB loader... checksum matches 0x276e Ok
Executing Ferly USB loader... Ok                  
Waiting for Fernly USB loader banner...

I suspect the usb loader never runs (or crashes?).

When booting the installed firmware, the onboard UART outputs:

F1: 0000 0000
V0: 0000 0000 [0001]
00: 1029 0001
01: 0000 0000
U0: 0000 0001 [0000]
G0: 0002 0000 [0000]
T0: 0000 0C73
Jump to BL

But nothing more.

I'm not using the codesourcery toolchain since it didn't build but recent mainline gcc + crossdev (which usually works fine for other ARM targets):

arm-none-eabi-gcc -v    
Using built-in specs.
COLLECT_GCC=arm-none-eabi-gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/arm-none-eabi/14/lto-wrapper
Target: arm-none-eabi
Configured with: /var/tmp/portage/cross-arm-none-eabi/gcc-14.2.1_p20241221/work/gcc-14-20241221/configure --host=x86_64-pc-linux-gnu --target=arm-none-eabi --build=x86_64-pc-linux-gnu --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/arm-none-eabi/gcc-bin/14 --includedir=/usr/lib/gcc/arm-none-eabi/14/include --datadir=/usr/share/gcc-data/arm-none-eabi/14 --mandir=/usr/share/gcc-data/arm-none-eabi/14/man --infodir=/usr/share/gcc-data/arm-none-eabi/14/info --with-gxx-include-dir=/usr/lib/gcc/arm-none-eabi/14/include/g++-v14 --disable-silent-rules --disable-dependency-tracking --with-python-dir=/share/gcc-data/arm-none-eabi/14/python --enable-languages=c,c++ --enable-obsolete --enable-secureplt --disable-werror --with-system-zlib --enable-nls --without-included-gettext --disable-libunwind-exceptions --enable-checking=release --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo 14.2.1_p20241221 p7' --with-gcc-major-version-only --enable-libstdcxx-time --enable-lto --disable-libstdcxx-pch --enable-poison-system-directories --disable-libstdcxx-time --with-sysroot=/usr/arm-none-eabi --disable-gcov --disable-bootstrap --with-newlib --enable-multilib --disable-fixed-point --with-multilib-list=aprofile,rmprofile --disable-libgomp --disable-libssp --disable-libada --disable-systemtap --disable-valgrind-annotations --disable-vtable-verify --disable-libvtv --without-zstd --without-isl --disable-libsanitizer --disable-default-pie --enable-host-pie --disable-host-bind-now --disable-default-ssp --disable-fixincludes
Thread model: single
Supported LTO compression algorithms: zlib
gcc version 14.2.1 20241221 (Gentoo 14.2.1_p20241221 p7)

I have to disable optimization with -O0 since ld tries to replace strlen in bionic.c with the one from stdlib, which is disabled by --nostdlib

So it builds:

make CROSS_COMPILE=arm-none-eabi- V=1                                                                                                                         
mkdir -p build/genhdr build/scriptic                                                                                                                                                                                 
gcc fernly-usb-loader.c sha1.c -o build/fernly-usb-loader                                                                                                                                                            
touch build/genhdr/generated.h                                                                                                                                                                                       
AS usb-loader.S                                                                                                                                                                                                      
arm-none-eabi-gcc -march=armv5te -mfloat-abi=soft -Wall -O0 -ggdb -Iinclude -marm -fno-stack-protector -D__ASSEMBLY__  -c -o build/usb-loader.o usb-loader.S                                                         
AS scriptic/set-plls.S                                                                                                                                                                                               
AS scriptic/enable-psram.S                                                                                                                                                                                           
arm-none-eabi-gcc -march=armv5te -mfloat-abi=soft -Wall -O0 -ggdb -Iinclude -marm -fno-stack-protector -D__ASSEMBLY__  -c -o build/scriptic/enable-psram.o scriptic/enable-psram.S                                   
arm-none-eabi-gcc -march=armv5te -mfloat-abi=soft -Wall -O0 -ggdb -Iinclude -marm -fno-stack-protector -D__ASSEMBLY__  -c -o build/scriptic/set-plls.o scriptic/set-plls.S                                           
AS scriptic/spi.S                                                                                                                                                                                                    
arm-none-eabi-gcc -march=armv5te -mfloat-abi=soft -Wall -O0 -ggdb -Iinclude -marm -fno-stack-protector -D__ASSEMBLY__  -c -o build/scriptic/spi.o scriptic/spi.S                                                     
AS scriptic/spi-blockmode.S                                                                                                                                                                                          
arm-none-eabi-gcc -march=armv5te -mfloat-abi=soft -Wall -O0 -ggdb -Iinclude -marm -fno-stack-protector -D__ASSEMBLY__  -c -o build/scriptic/spi-blockmode.o scriptic/spi-blockmode.S                                 
AS scriptic/keypad.S                                                                                                                                                                                                 
arm-none-eabi-gcc -march=armv5te -mfloat-abi=soft -Wall -O0 -ggdb -Iinclude -marm -fno-stack-protector -D__ASSEMBLY__  -c -o build/scriptic/keypad.o scriptic/keypad.S                                               
AS start.S
arm-none-eabi-gcc -march=armv5te -mfloat-abi=soft -Wall -O0 -ggdb -Iinclude -marm -fno-stack-protector -D__ASSEMBLY__  -c -o build/start.o start.S                                                                   
CC bionic.c                                                                                                                                                                                                          
arm-none-eabi-gcc -march=armv5te -mfloat-abi=soft -Wall -O0 -ggdb -Iinclude -marm -fno-stack-protector -c -MD -o build/bionic.o bionic.c                                                                             
CC cmd-hex.c                                                                                                                                                                                                         
arm-none-eabi-gcc -march=armv5te -mfloat-abi=soft -Wall -O0 -ggdb -Iinclude -marm -fno-stack-protector -c -MD -o build/cmd-hex.o cmd-hex.c                                                                           
CC cmd-irq.c                                                                                                                                                                                                         
arm-none-eabi-gcc -march=armv5te -mfloat-abi=soft -Wall -O0 -ggdb -Iinclude -marm -fno-stack-protector -c -MD -o build/cmd-irq.o cmd-irq.c                                                                           
CC cmd-peekpoke.c                                                                                                                                                                                                    
arm-none-eabi-gcc -march=armv5te -mfloat-abi=soft -Wall -O0 -ggdb -Iinclude -marm -fno-stack-protector -c -MD -o build/cmd-peekpoke.o cmd-peekpoke.c                                                                 
CC cmd-reboot.c                                                                                                                                                                                                      
arm-none-eabi-gcc -march=armv5te -mfloat-abi=soft -Wall -O0 -ggdb -Iinclude -marm -fno-stack-protector -c -MD -o build/cmd-reboot.o cmd-reboot.c                                                                     
CC cmd-sleep.c                                                                                                                                                                                                       
arm-none-eabi-gcc -march=armv5te -mfloat-abi=soft -Wall -O0 -ggdb -Iinclude -marm -fno-stack-protector -c -MD -o build/cmd-sleep.o cmd-sleep.c                                                                       
CC cmd-spi.c                                                                                                                                                                                                         
arm-none-eabi-gcc -march=armv5te -mfloat-abi=soft -Wall -O0 -ggdb -Iinclude -marm -fno-stack-protector -c -MD -o build/cmd-spi.o cmd-spi.c                                                                           
CC cmd-led.c                                                                                                                                                                                                         
arm-none-eabi-gcc -march=armv5te -mfloat-abi=soft -Wall -O0 -ggdb -Iinclude -marm -fno-stack-protector -c -MD -o build/cmd-led.o cmd-led.c                                                                           
CC cmd-load.c                                                                                                                                                                                                        
CC cmd-bl.c
arm-none-eabi-gcc -march=armv5te -mfloat-abi=soft -Wall -O0 -ggdb -Iinclude -marm -fno-stack-protector -c -MD -o build/cmd-load.o cmd-load.c
CC cmd-lcd.c
arm-none-eabi-gcc -march=armv5te -mfloat-abi=soft -Wall -O0 -ggdb -Iinclude -marm -fno-stack-protector -c -MD -o build/cmd-bl.o cmd-bl.c
arm-none-eabi-gcc -march=armv5te -mfloat-abi=soft -Wall -O0 -ggdb -Iinclude -marm -fno-stack-protector -c -MD -o build/cmd-lcd.o cmd-lcd.c
CC cmd-keypad.c
arm-none-eabi-gcc -march=armv5te -mfloat-abi=soft -Wall -O0 -ggdb -Iinclude -marm -fno-stack-protector -c -MD -o build/cmd-keypad.o cmd-keypad.c
CC emi.c
arm-none-eabi-gcc -march=armv5te -mfloat-abi=soft -Wall -O0 -ggdb -Iinclude -marm -fno-stack-protector -c -MD -o build/emi.o emi.c
CC irq.c
arm-none-eabi-gcc -march=armv5te -mfloat-abi=soft -Wall -O0 -ggdb -Iinclude -marm -fno-stack-protector -c -MD -o build/irq.o irq.c
CC lcd.c
arm-none-eabi-gcc -march=armv5te -mfloat-abi=soft -Wall -O0 -ggdb -Iinclude -marm -fno-stack-protector -c -MD -o build/lcd.o lcd.c
CC main.c
arm-none-eabi-gcc -march=armv5te -mfloat-abi=soft -Wall -O0 -ggdb -Iinclude -marm -fno-stack-protector -c -MD -o build/main.o main.c
CC scriptic.c
CC serial.c
arm-none-eabi-gcc -march=armv5te -mfloat-abi=soft -Wall -O0 -ggdb -Iinclude -marm -fno-stack-protector -c -MD -o build/scriptic.o scriptic.c
arm-none-eabi-gcc -march=armv5te -mfloat-abi=soft -Wall -O0 -ggdb -Iinclude -marm -fno-stack-protector -c -MD -o build/serial.o serial.c
CC spi.c
arm-none-eabi-gcc -march=armv5te -mfloat-abi=soft -Wall -O0 -ggdb -Iinclude -marm -fno-stack-protector -c -MD -o build/spi.o spi.c
CC utils.c
arm-none-eabi-gcc -march=armv5te -mfloat-abi=soft -Wall -O0 -ggdb -Iinclude -marm -fno-stack-protector -c -MD -o build/utils.o utils.c
utils.c: In function 'serial_print_hex_offset':
utils.c:52:17: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   52 |                 for (byte = 0; byte < 16 && byte + offset < count; byte++)
      |                 ^~~
utils.c:56:25: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   56 |                         serial_puts("|\n");
      |                         ^~~~~~~~~~~
CC vectors.c
arm-none-eabi-gcc -march=armv5te -mfloat-abi=soft -Wall -O0 -ggdb -Iinclude -marm -fno-stack-protector -c -MD -o build/vectors.o vectors.c
CC vsprintf.c
arm-none-eabi-gcc -march=armv5te -mfloat-abi=soft -Wall -O0 -ggdb -Iinclude -marm -fno-stack-protector -c -MD -o build/vsprintf.o vsprintf.c
arm-none-eabi-objcopy -S -O binary build/usb-loader.o build/usb-loader.bin
arm-none-eabi-ld --nostdlib -T fernvale.ld --entry=reset_handler -o build/firmware.elf build/scriptic/set-plls.o build/scriptic/enable-psram.o build/scriptic/spi.o build/scriptic/spi-blockmode.o build/scriptic/keypad.o build/start.o build/bionic.o build/cmd-hex.o build/cmd-irq.o build/cmd-peekpoke.o build/cmd-reboot.o build/cmd-sleep.o build/cmd-spi.o build/cmd-led.o build/cmd-load.o build/cmd-bl.o build/cmd-lcd.o build/cmd-keypad.o build/emi.o build/irq.o build/lcd.o build/main.o build/scriptic.o build/serial.o build/spi.o build/utils.o build/vectors.o build/vsprintf.o lib/libgcc-armv5.a
arm-none-eabi-objcopy -S -O binary build/firmware.elf build/firmware.bin

Does anyone have a hint on what to try next to get the bootloader running?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant