Nuclei-Software / nuclei-linux-sdk

Nuclei RISC-V Linux Software Development Kit
Apache License 2.0
38 stars 9 forks source link

Linux Bringup suggestion when using Nuclei RISC-V CPU #21

Open fanghuaqi opened 4 months ago

fanghuaqi commented 4 months ago

Nuclei RISC-V CPU IP user should following this guidance to port your SoC to enable quickly linux bringup and then you can port linux to your own linux sdk platform.

Nuclei Linux SDK is a really simple Linux SDK platform for customer to quickly bring up their SoC with Linux.

If you find there is something wrong with our document, please create a issue, and let us improve it.

[!NOTE]

  • Make sure you have confirmed that your L1/L2 cache integration is correct and testing passed, please cowork with your team member to make sure it is ok. For software, you can disable L1 and L2 cache in freeloader to see whether cache is not ok which affect normal boot.
  • If you are using SMP core, please make sure single core version works by generate a single core version bitstream, and then port a smp version.
  • If you are using SMP core, you also need to update openocd configuration file, if you want to debug it, please contact with our AE for help about how to update this configuration file.
  • Please take care clint0 in dts should be nuclei timer base address + 0x1000, please check Nuclei ISA Spec
  1. Nuclei Linux SDK is developed for Nuclei evaluation SoC which is very simple, with SPI XIP Flash, UART, and SPI SDCard and DDR memory enabled evaluation SoC, for details about this SoC, please see our Nuclei_Eval_SoC_Intro.pdf
  2. Our evaluation SoC don't have a bootrom to do some basic SOC initialization and load image from flash or other storages to memory, so we create a software called freeloader to handle this.
  3. If your DDR memory need to be initialized, you can do this in freeloader code, just like fsl91030m's freeloader does in https://github.com/Nuclei-Software/freeloader/blob/8f27d8dc7d92ba13b4f6f62039dc09abbc5731cd/freeloader.S#L94-L176, this kind of asm code is generated from c code, and just disassemble it, and copy and adapted to freeloader code
  4. Nuclei Linux SDK has different branches to evaluate different Linux version and different features, see #2 , so you should choose a correct branch you want to use, and following the guidance in that branch
  5. For example, for dev_nuclei_5.10_v2 branch, you should check its README.md in https://github.com/Nuclei-Software/nuclei-linux-sdk/blob/dev_nuclei_5.10_v2/README.md, and it has a Port to your target section to tell you how to port your SoC to this linux SDK and help you to bringup.
  6. We strongly requested you to bring up your SoC using our Linux SDK, it will be easy to debug what is not acting as expected, if the bring up is done, then you can port it to your own SDK environment, it will be much easier.
  7. When you are expecting to use some higher level feature such as OpTEE, please make sure normal linux is already brought up, and then you can follow the guidance in OpTEE feature branch.

    NOTE: You may need to do two versions of bitstream, first version for normal boot, just configure cpu without any secure feature, and do a bitstream, when comes to optee related porting, then you can configure cpu with secure feature, and do a bitstream and port linux to it.

  8. About how to debug linux, uboot, opensbi, please check https://github.com/Nuclei-Software/nuclei-linux-sdk/wiki/Debug-Linuxsdk-using-NucleiStudio
  9. Regarding the frequently asked questions, please check #12

Thanks

fanghuaqi commented 4 months ago

Our own porting to fsl91030m is based on commit 00e1fc1070b426c58137d853ac293ea6e1b289d7, you can see all the changes we have made to it, see https://github.com/Nuclei-Software/nuclei-linux-sdk/compare/00e1fc...feature/fsl, this porting is a best practice about this suggestion.

image