nuttx icon indicating copy to clipboard operation
nuttx copied to clipboard

May i get some help before starting porting NuttX to a new arch namely LoongArch

Open GooTal opened this issue 3 years ago • 11 comments

Hello there, I`m trying to port NuttX to LoongArch, which is used in 64-bit microcontroller. Currently i`m a student and hope to learn some OS knowledge during porting.

Is it a good choice to take riscv-k210 as a referrence? I`m planning to read documents from official NuttX website. I`ve glanced some code snippets and found the code for uart, interrupt and so on. But i didn`t find out how the memoy page table was established (Sorry for my poor knowledge). Can i get some help about memory mapping? Like: the layout of virtual memory.

Could you tell me something about the proper process of porting NuttX? Maybe start with head.S, uart, memory mapping...and something else?

Thanks a lot :)

GooTal avatar Nov 09 '22 14:11 GooTal

Hi @GooTal I think LoongArch (from 龙芯) is based on MIPS instruction set. We have support for MIPS, but not for MIPS 64-bit yet. Since riscv-k210 is RISC-V 64-bit and RISC-V ISA is similar to MIPS maybe it could be a good starting point.

You can use our old Porting Guide ( https://cwiki.apache.org/confluence/display/NUTTX/Porting+Guide ) as reference, but always comparing with the source code because some functions name and files could have changed or moved to other places. If you can document the Porting Process to create a new documentation to include on our new Documentation site: https://nuttx.apache.org/docs/latest/ it will be welcome!

acassis avatar Nov 09 '22 15:11 acassis

Alright, thank you!

GooTal avatar Nov 10 '22 00:11 GooTal

Hi, i want to make sure that NuttX is fully open source, right? I investigated another RTOS namely rt-thread, but some libraries of rt-thread is prebuilt (not open source), thus making it difficult for me to debug or continue learning. Thanks for your time again.

GooTal avatar Nov 16 '22 02:11 GooTal

Hi @acassis , is the porting guide still in maintenance?

Is there a git repo for the porting guide? Maybe it`s more convenient to maintain and discuss details of the doc in a git repo.

Thanks.

GooTal avatar Dec 07 '22 03:12 GooTal

Hi @acassis , is the porting guide still in maintenance?

Here is he new location: https://nuttx.apache.org/docs/latest/reference/os/index.html

Is there a git repo for the porting guide? Maybe it`s more convenient to maintain and discuss details of the doc in a git repo.

Yes, it's here: https://github.com/apache/nuttx/tree/master/Documentation you can send the change to github directly, the website will automatically update to contain your modification once the patch get merged.

Thanks.

xiaoxiang781216 avatar Dec 07 '22 04:12 xiaoxiang781216

Hi, i want to make sure that NuttX is fully open source, right?

Yes, all OS component and the bundle apps(https://github.com/apache/nuttx-apps) are open source with Apache license(some are MIT/BSD etc), you can reference here for more info: https://github.com/apache/nuttx/blob/master/LICENSE

I investigated another RTOS namely rt-thread, but some libraries of rt-thread is prebuilt (not open source), thus making it difficult for me to debug or continue learning. Thanks for your time again.

But some chip drivers(especially WiFi/BLE firmware) is released by the static library, e.g.: https://github.com/apache/nuttx/blob/master/arch/risc-v/src/esp32c3/Make.defs#L181-L212

xiaoxiang781216 avatar Dec 07 '22 04:12 xiaoxiang781216

Thanks a lot @xiaoxiang781216!

GooTal avatar Dec 07 '22 06:12 GooTal

Hi, i`m trying to add some config items in Kconfig files. I notice that there is a $ARCH variable in ${TOPDIR}/Kconfig file. I think it may stand for host cpu arch. But i couldn`t find out where the definition is.

Here are the steps:

In ${TOPDIR}

./tools/configure.sh -l maix-bit:nsh
make menuconfig

As you can see, the mainmenu is "NuttX/x86_64 Configuration" . So $ARCH=x86_64. But where is the definition of $ARCH? 图片

Thanks for your time~

GooTal avatar Jan 04 '23 08:01 GooTal

I believe this is set via the “System Type” menu at the top level.

You may know this (I only recently learnt about it) but if not then: if you type a forward slash while in the menuconfig it brings up a search. If you search for ARCH it points you to line 161 of arch/Kconfig which is always one way of finding out what’s available and where. Each search result also has a numbered result – if you type in that number it takes you to the actual menuconfig menu for that result.

From: Qingtao Liu @.> Sent: 04 January 2023 08:39 To: apache/nuttx @.> Cc: Subscribed @.***> Subject: Re: [apache/nuttx] May i get some help before starting porting NuttX to a new arch namely LoongArch (Issue #7566)

Hi, im trying to add some config items in Kconfig files. I notice that there is a $ARCH variable in ${TOPDIR}/Kconfig file. I think it may stand for host cpu arch. But i couldnt find out where the definition is.

Here are the steps:

In ${TOPDIR}

./tools/configure.sh -l maix-bit:nsh

make menuconfig

As you can see, the mainmenu is "NuttX/x86_64 Configuration"

Thanks for your time~

— Reply to this email directly, view it on GitHub https://github.com/apache/nuttx/issues/7566#issuecomment-1370622182 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ANQZJKJ254KMWNE3G3L6RSTWQUZITANCNFSM6AAAAAAR3P2XQM . You are receiving this because you are subscribed to this thread. https://github.com/notifications/beacon/ANQZJKIXHX7OCPAKLBJEYDDWQUZITA5CNFSM6AAAAAAR3P2XQOWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTSRWIEOM.gif Message ID: @.*** @.***> >

TimJTi avatar Jan 04 '23 12:01 TimJTi

Hey, i noticed that the aclint base for risc-v qemu is defined like this:

#define QEMU_RV_ACLINT_BASE  0x02f00000

I can`t find out the related specification, but only found this https://github.com/riscv/riscv-aclint/releases/download/v1.0-draft2/riscv-aclint-1.0-draft2.pdf. It seems this doc does not mentioned the aclint base addr 0x02f00000.

Can you provide some info about the related specification?

GooTal avatar Feb 13 '23 05:02 GooTal

Hi @GooTal

I'm Xunmi from the LoongArch Community. We noticed your previous work on porting NuttX to LoongArch and would love to know:

Is this effort still active? Could you share the current status/progress? If helpful, our community can provide hardware resources (e.g., LoongArch-based testing devices) to support this initiative. Looking forward to hearing from you!

xunmi-git avatar May 09 '25 09:05 xunmi-git