gabriele-galeotti / SweetAda

Ada-language framework
https://sweetada.org
Other
38 stars 5 forks source link

[NEORV32] Update ULX3S/Litex registers and first Proof-Of-Concept #9

Closed Irvise closed 5 months ago

Irvise commented 5 months ago

Hi Gabriele,

I finally got everything set-up in such a way that NEORV32, when compiled within the Litex framework, works on the ULX3S!

Here are a few notes about this PR, which is not perfect by any means...

  1. The machine registers have been added. They substitute the base NEORV32 ones by the Litex ones.
    1. There are some style warnings due to the comments.
  2. The bsp.adb saw a few changes due to the difference in the machine registers. I followed the setup used in the C code examples used by Litex.
  3. I modified the linker so that everything would fall into RAM and ROM would not get used. This is a bit counter intuitive, so let me explain.
    1. The core does allow for RAM & ROM at the specified regions, there is no issue there.
    2. The CPU starts executing RAM at address 0x40000000. The _startup code was in the ROM region, therefore, nothing was being executed correctly.
    3. The way I upload the kernel to the board is by uploading it via serial when the board resets and it starts executing immediately after the load. Therefore, putting everything into RAM just makes it work :)
    4. Maybe I could change the _startup region to go into RAM and the rest could be left as is... But I have not tested it and I would also prefer to hear if you have any feedback on the mater.
  4. The MTIME addresses had to be changed in the configure.in file. I updated the values as per the latest documentation of the NEORV32 core.
    1. The base MTIME address values may have changed from when you started adding support to the NEORV32. The CPU does sometimes see some breaking changes. I am using version 1.9.7 of the NEORV32 softcore (the one currently in use by Litex)
    2. The code is formatted in the default manner that Emacs formats it. It is not as clean nor as pretty as they style you are using for the Ada files...
    3. Could I ask you if it is fine if you format them/style them? I did not find a gnat pretty or gnatpp command in the repository to format the files...

I hope these changes are fine by you. The leds are blinking and the UART works :)

Best regards, Fer