The first issue arose because atto reasonably expects the OS to clear its global variables whenever it is started. I had initially used it as a loadable extension, and the startup code that the TCCLINK
command generates when linking something with a main()
function takes care of that. When embedding atto, however, that doesn't happen, so I had to add some code to do it manually.
The second issue was a bit tricky. It turned out that the lib-h3 MMC driver expects buffers to be word-aligned, but POSIX write()
does not. So I had to add some code to the _write_r()
and _read_r()
implementations in allwinner-bare-metal to copy unaligned buffers. The reason why that has never been triggered from BASIC is that the interpreter never uses unaligned buffers...
Anyway, both issues will be fixed in the next build.