I am also introducing an "allwinner" directory to hold shared driver code for these two chips. I make links from the h3 and h5 directories to these source files. There is some danger that I might make changes to a file while working on the H3 that breaks the H5 (or vice versa), but so far this has not arisen.
There are several reasons for this. First is that h3 and h5 involve less typing. More important is that there are interesting boards from other manufacturers (such as Neopi) that use these chips.
Doing this also involves updating the Kyu "config" script, and then doing a build for both H3 and H5 to see what issues turn up.
One issue is missing "dhry_main()". I introduce a Kyu config option "WANT_DHRY" and simply don't define it to fix this issue.
I get warnings from the linker.
This is a stupid business that should not affect
someone doing embedded development.
The people working on Gnu ld are thinking only of
the linux kernel and application code.
So I see this:
rm-none-eabi-ld.bfd --no-warn-rwx-segments -r -o ../machine.o locore.o armv6_start.o hardware.o ram.o interrupts.o cache.o cache_v7.o mmu.o show_regs.o cpufunc_asm_armv7.o eabi_stubs.o arm-none-eabi-ld.bfd: warning: eabi_stubs.o: missing .note.GNU-stack section implies executable stack arm-none-eabi-ld.bfd: NOTE: This behaviour is deprecated and will be removed in a future version of the linkerAnd this:
arm-none-eabi-ld.bfd: warning: machine.o: requires executable stack (because the .note.GNU-stack section is executable)I already have this option on the linker command line, which suppresses one set of stupid warnings.
arm-none-eabi-ld.bfd --no-warn-rwx-segmentsThere are two possible solutions. One is to use the "-z noexecstack" linker option, which you may need to pass like this if you use "cc" as your linker:
-Wl,-z,noexecstack
The other is to add this weird bit of boilerplate to each assembly source file:
.note.GNU-stack,"",@progbitsI add this to:
src/armv7/armv7_cache.SThe other ".S" files in this directory already have the boilerplate. But this is not sufficient to suppress the warning. I end up needing to add the "-z noexecstack" option to the link line in the top level makefile.
arm-linux-gnu-gcc: command not foundSo, there are two ARM gcc compilers available in the Fedora packages for aarch32. Apparently I used one for the BBB and the other for H3, for no particular reason.
I take some time now to read about this. The claim is that the "linux" flavor expects
the full glibc and is for applications that will run on the linux OS.
The noeabi is for what I am doing (embedded, bare metal coding).
A person could drag in "newlib" to get various library routines (but I don't do this).
The easy thing is to just install the other compiler:
su dnf install gcc-arm-linux-gnuAfter installing the compiler, we type make and get a clean build!
#define BOARD_H5 #define BOARD_ORANGE_PI_PC2The first define is the one most often used. The second board specific define is used to cope with actual differences among H5 based boards. For example the NeoPi boards use a different IO pin for the status LED than does the OrangePi board.
The game now is to go through the code and clean up the use of these BOARD selection definitions, using H5 or H3 whereever possible and the actual board specific ones only as strictly needed.
Note that our "config" script deals only with H5 vs H3 vs BBB, but not specific boards within H5 or H3. To build for a specific board requires hand editing the definitions in board.h before running make.
I have to remember that the H3 files are well tested. The H5 files are in most cases simply copies of H3 files and untested. Sometimes I have made changes to the H3 files subsequent to the copy, and those changes need to be reviewed.
There are some files in the H3 directory that are links to files in the bbb directory. These are hardware independent i2c files that ought to get moved to a "driver" directory (which does not yet exist).
Red "status" LED on PA15 Green "power" LED on PL10The H5 manual calls the mysterious last GPIO the "L" gpio.
Tom's electronics pages / tom@mmto.org