I'm studying bare metal programming in the RPi, and now I'm trying to upload code via the UART to avoid constantly removing and inserting the memory card in order to copy the program.
I've tested the Mini UART at 115200 transmitting from the RPi to Linux running minicom, and everything worked just fine. My test consisted in streaming the entire ASCII movie found here: http://www.asciimation.co.nz/index.php
I then wrote code to read ihex files from the UART, but it doesn't work and I can't for the life of me find the reason. At first I though it was the memory barriers that I was neglecting to add, but then I added them and the problem persisted. I increased to places where the memory barriers are executed up to around all peripheral reads and writes, but the exact same problem persisted.
Code: Select all
Welcome to minicom 2.7.1 OPTIONS: I18n Compiled on Aug 13 2017, 15:25:34. Port /dev/ttyUSB0, 22:55:03 Press CTRL-A Z for help on special keys Waiting for file Read char 0 Read char 2 Read byte 02 Record has 02 bytes Read char 0 Read char 0 Read byte 00 Read char 0 Read char 0 Read byte 00 Read word 0000 Offset is 0000 Read char 0 Read char 2 Read byte 02 Record type is 02 Reading data bytes Read char 1 Read char 0 Read byte 10 Read char 2 Read char 0 Read byte 20 Read char E Read char \x0a Error, invalid hexa digit \x0a Waiting for file
My code is here in case anyone can take a look: https://github.com/leiradel/barebones-r ... arebones08
The kernel that sets up the environment is in the kernel folder. It doesn't free any secondary cores, for now only the primary core runs. It waits for something in the UART, then tries to decode an ihex file, but right at the beginning, in the first line, it seems to skip characters, which causes the kernel to abandon the download, go to the top of the loop, and wait for another file.
Maybe the ihex decoding has bugs but that's not my concern, I can iron them out once the UART is working.
Any help is appreciated. Maybe it's something obvious, maybe I just need to take a break and code something else for a while