Hi Brian,
Thanks for your great tutorials! I wanted to alert you to a problem I just encountered, in case others experience similar...
I was compiling (build.sh) and trying to run part-1 / armc-03 and watching for a blinking LED, with no joy. A clue as to the problem was coming out of the linker:
/arm-none-eabi/bin/ld: warning: cannot find entry symbol _start; defaulting to 0000000000008024.
Using objdump to produce a disassembly listing, I found the linker was putting a small stack (space reservation) at 0x8000 and following that with the main() entry point. If I understand Pi booting correctly, that would have the CPU jumping into the stack instead of to main().
I've gotten relief by adding some linker directives: (file linker.ld)
MEMORY
{
ram : ORIGIN = 0x8000, LENGTH = 20K
}
SECTIONS
{
.text : { *(.text*) } > ram
.note.gnu.build-id : { *(.text*) } > ram
.bss : { *(.bss*) } > ram
}
And adding this, via the -T option, to the executable build:
${toolchain}gcc ${cflags} ${scriptdir}/*.c -T linker.ld -o ${kernel_elf}
In short, I had to force the .text section (i.e. the main() program) to be at the top of the img. This (finally) yielded a satisfying blink. :-)
For what it matters: I'm cross-compiling for pi0 from Ubuntu 18.04 using ARM Corp's gnu
armc-03$ arm-none-eabi-gcc --version
arm-none-eabi-gcc (GCC) 8.2.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Cheers!