sipeed / TangNano-9K-example

TangNano-9K-example project
227 stars 70 forks source link

problem compiling provided .c files #18

Closed gustavosousa2208 closed 11 months ago

gustavosousa2208 commented 1 year ago

Sorry for the question, i'm a begginer and fell like some things of the picotiny are not well documented, like the addresses of peripherals. When i clone the repository and flash the default example file provided, it works like a charm, but when i compile and flash the UART won't respond at all and the HDMI output shows the default background and some garbage.

this is my toolchain RISCV_NAME ?= riscv-none-elf RISCV_PATH ?= /home/gusta/.local/xPacks/@xpack-dev-tools/riscv-none-elf-gcc/13.2.0-2.1/.content/

Can someone help with tips for compiling, the adresses os peripherals and how to get simple UART input output from the provided code?

dashxdr commented 11 months ago

I was having no luck making changes to the picotiny/fw/fw-flash/firmware.c file, even though I tried these xpack versions: xpack-riscv-none-elf-gcc-13.2.0-2-linux-x64.tar.gz xpack-riscv-none-embed-gcc-10.2.0-1.2-linux-x64.tar.gz

Finally I noticed the file picotony/fw/fw-flash/Makefile has this: RISCV_PATH ?= D:/gnu-mcu-eclipse-riscv-none-gcc-8.2.0 So I got an older compiler from here: https://github.com/xpack-dev-tools/riscv-none-embed-gcc-xpack/releases/tag/v8.2.0-3.1

I unpack it in my /ram drive and my settings are as follows:

export RISCV_NAME=riscv-none-embed
export RISCV_PATH=/ram/xPacks/riscv-none-embed-gcc/8.2.0-3.1
export COMx=/dev/ttyUSB1
export PYTHON_NAME=python3

Then the serial port appearing on /dev/ttyUSB1 shows the correct menu items:

Select an action:

[1] Toggle led 1
[2] Toggle led 2
[3] Toggle led 3
[4] Toggle led 4
[5] Toggle led 5
[6] Toggle led 6

The menu was appearing on the hdmi display once I programmed the first picotiny.fs image, which suggests the dev board had that image programmed in when it first arrived, but the serial port baud rate wasn't correct.

gustavosousa2208 commented 11 months ago

That was very clever! I've managed to compile with this toolchain version, with any CLK_FREQ it doesn't work with the new toolchain. I had given up on this picotiny for learning riscv, but now i can resume my study. Thanks ! 👍

Captura de tela 2023-12-26 191247

dashxdr commented 11 months ago

I added to the pull request, the underlying cause was a python script reading the verilog output format of objdump, it parsed the old version's out put but not the newer ones.