Topic: bootloader question - towards an osmocom-bb firmware
I wrote a very short led-on assembly firmware based on usb-loader.S. I can get it to load and turn the LED on only if I load it in place of firmware.bin in the
fernly-usb-loader command line. I was wondering why this is the case? Is there some magic I'm not thinking of?
I tried moving the stack further up but that didn't seem to make any difference. I can proceed by using the usb-loader.bin and then an osmocom layer1.bin
after that but wondered why this was necessary?
.text
.global _start
_start:
disable_interrupts:
mrs r0, cpsr
mov r1, #0xc0
orr r0, r0, r1
msr cpsr_cxsf, r0
relocate_stack:
//ldr r0, =0x7000bffc // stack_start
ldr r0, =0x70010000 // relocate stack FURTHER?
mov sp, r0
disable_system_watchdog: // from main.c:do_init()
ldr r1, =0xa0030000
ldr r0, =0x2200
str r0, [r1]
enable_usb_download_mode:
ldr r1, =0xa0700a28 // PMIC_CTRL10
ldr r0, =0x8000
str r0, [r1]
disable_battery_watchdog:
ldr r1, =0xa0700a24 // PMIC_CTRL9
mov r0, #0x2
str r0, [r1]
led_on:
ldr r1, =0xa0700c80
mov r0, #0x3
str r0, [r1]
loop:
bl loop
and starting like this works:
./build/fernly-usb-loader -s /dev/fernvale ./build/usb-loader.bin ./build/led-on.bin
but this does not (LED doesn't come on):
./build/fernly-usb-loader -s /dev/fernvale ./build/led-on.bin ./build/led-on.bin