-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Draft: RV32M1: Port to the cortex-m4 core #27497
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
df09cc2 to
e363871
Compare
Add new SOC_OPENISA_RV32M1 kconfig symbol to allow having options common to both the RISCV and ARM cores. Signed-off-by: Karsten Koenig <[email protected]>
Add the M4 core of the RVM32M1 SoC and a corresponding board configuration to enable the core on the vega board. Signed-off-by: Karsten Koenig <[email protected]>
For the RV32M1 cortex_m4 core the soc.h needs to be included early, otherwise the device tree macros can not find the physical instances during compilation. Signed-off-by: Karsten Koenig <[email protected]>
e363871 to
cd138ad
Compare
Need to temporarily point to my own openisa_hal repo to create a consistent state for buildkite to verify. Signed-off-by: Karsten Koenig <[email protected]>
cd138ad to
6f34432
Compare
|
Fixed the compliance and most build buildkite issues, but it still points out an issue where |
The RV32M1 lptmr doesn't support tickless operation, but this lead to a situation where there was no timer available as the system timer, due to a conflict with the !TICKLESS_IDLE dependency. As the RV32M1 timer doesn't set TICKLESS_CAPABLE we can remove the dependency on !TICKLESS_IDLE. Signed-off-by: Karsten Koenig <[email protected]>
|
Fixed the remaining issue shown by buildkite, it was a KConfig dependency issue. To double check I also actually ran the affected testcases and they pass :-) So all checks are green now, and I'd welcome feedback if my port is going in the right direction. I also tried digging into openocd or pyOCD config files, but it all seems very opaque and quite beyond my capabilities. Sadly the segger JLink solution provided by openisa/NXP isn't really that smooth of an experience, one has to copy some extra segger FLM files and so on into the segger install folder. Took a while to actually find them :-( https://open-isa.org/community/topic/jlink-patch-for-rv32m1/ |
|
This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time. |
|
@karstenkoenig very nice work! One main advantage of this platform is to compare RISC- and ARM based performance and it would be cool to have all cores supported by the OS. I would be very interested in playing around with your port and could also provide some testing, though, I don't really know about the development procedures in zephyr. So far I was able to compile hello_world but it remains unclear to me how to flash the Cortex-M4. Would you share more detailed instructions on that? |
|
Hi @PeterKietzmann great to hear that you are interested! sorry for dragging this here out. The documentation about flashing/using is what's mostly still missing here and it will probably always be rough as I couldn't find any openocd config that would make integration with zephyr straight forward. Please download their ARM SDK here Prepping JLink: Anyways, once you get your JLink to a state where you can select an RV32M1_M4 or so you can continue with - Selecting the core to execute: Flashing and debugging the arm core: Good luck! I wish there was an openocd solution. I don't know enough about openocds operation, but I believe it should be possible to just use the same flashing operation as for the risc-v core as that access port should work for flashing all the time. But not sure I really want to dig into that to be honest :-| |
|
@karstenkoenig many thanks for the information! I was able to flash and boot from the Cortex M4 now. Some additional remarks on flashing (from Linux):
|
|
Thanks for pulling through and documenting the detailed steps. But to be honest this is sort of why I didn't really progress with documentation, because applying that JLink patch feels so ridiculously dirty and having to peel it out of the windows sdk is just the cherry on top :-( @dleach or @MaureenHelm is there a chance to get Segger to include the RV32M1_M4 and _M0plus devices into their JLink bundles? |
This ports Zephyr to the RV32M1 cortex m4 core. Tested the uart, i2c and spi operation with some samples.
It creates a shared RV32M1 KConfig option and adds dts/soc/board definition based on the risc-v version.
I also started porting the M0+ core, but it only has 32 IRQs for NVIC and the rest would require porting the multilevel IRQ feature to NVIC, not sure if that would be well received. The M0+ cores usefulness seems very limited with only the first level 32 IRQs
Draft status due to remaining issues:
boards/common,dts/commonandsoc/commondon't exist / seem unusable in this case so there is a lot of duplication -> I don't feel very confident in this part of the build system, but I wouldn't mind looking into it a for a follow up PRRequires this openisa hal pullrequest:
zephyrproject-rtos/hal_openisa#6
I am quite impressed how little there was to add to support the Cortex-M4 core and how easy it was to get it running! And a lot of that can also be common and core independent code/dts data :-)