Add support for the BCM2711 - #15188
Conversation
|
It is going to take me a while to squash all these commits |
Hi @linguini1 I suggest you to squash in a way that the mental logic you used to get this port working be preserved. You can use squash the commits that created the headers files and the commits that fix them. Then they will appear early as an initial commit. Preserving it will be useful to help other people to do the port to other chips. @xiaoxiang781216 what do you think? |
hartmannathan
left a comment
There was a problem hiding this comment.
I haven't reviewed yet but I would like to express support -- this is definitely an asset to NuttX. Also, it is a good idea to make it possible for the community to help develop it.
I think it's a good idea to mention in the Docs what is known to work right now and what is missing, to help set the right expectations and guide other interested people at what they could work on to improve support.
hartmannathan
left a comment
There was a problem hiding this comment.
Don't do it yet, but when it's getting close to ready for merge, it will be a good idea to squash the commits.
@hartmannathan I suggest squashing it in a logic way to preserve the history, this way it could help other people doing ports in the future. For instance all commits adding the headers files or fixing it could be squashed together. This way it will be reduced for about 10 commits or so. What do you think? |
I also took some notes while doing this port to attempt to make it easier for the next people trying to port new boards. I don't think they're incredibly helpful but I can post them somewhere if it might help. |
@acassis yes, this is a good idea. (I was only suggesting to reduce the 173 commits but it doesn't need to be squashed into 1.) |
@linguini1 there is a porting guide at https://nuttx.apache.org/docs/latest/guides/port.html (Documentation/guides/port) and if you have anything helpful to add there, please do! Another idea is to add a separate document: Porting Case Studies and document the RPi 4b port as a case study. |
930bf93 to
54d80e4
Compare
|
Not too sure from reading the error logs why this build is failing. Anyone have an idea? |
Yes that's correct. I replied to xiaoxiang781216 before I noticed that the 170+ commits were already squashed to 4. I think it is OK to keep it as-is. Only the defconfig issue needs to be updated and then I think it will be ready for merge. |
Yes, but your later commit fixes many errors in early commit. You should ensure each commit can be build and pass ci correctly, instead ignoring them until the last commit. For example:
So, you either squash ALL commit into one patch, or split the huge change into the independent patchset. Actually, I prefer you select the second approach, but you need organize your patch clearly: one patch adds one driver and not touch other driver. |
Oh I see, that makes sense. Okay, I'll squash into one commit. |
|
BTW, before you update pr, you can run the check locally: |
|
Still not quite sure about the failure here, the defconfig problem seems to have been resolved. Is it failing because of the generated config.txt? |
|
@linguini1 the issue is happening in another board: pinephone/lcd @lupyuen what do you think? Maybe some modification in the Kconfig reflected on pinephone? |
|
@linguini1 I think that is the case, you modified a main Kconfig at arch, so it will reflect in other boards. I suggest you to run a update for all arm64 boards: Then add these modified defconfigs in a separated commit, because they are not from your board, but affected by your modifications Updated: Initially I said all boards, but in fact the Kconfig is inside arch/arm64, so you just need to refresh boards from arm64 arch! |
How did you determine that? I am still getting used to reading through the build logs, but I don't see anything unusual under the step for |
See the message: Normally when you see that "Use git add -f " the defconfig is outdated. Our CI is really bad to indicate about the issue. I suggested coloring these text to help. @lupyuen do you have some idea how to make these error more visible? |
I thought that was something to do with config.txt, I see. I've now run the refresh tool against all the arm64 boards, but it appears nothing has changed. I suppose that means the defconfigs aren't the issue here? I used the command |
Strange, you can try another approach to confirm the defconfig has changed: $ ./tools/configure.sh pinephone/nsh $ make savedefconfig |
Still no changes, menuconfig does not ask me to save anything. I checked for differences earlier using |
|
@linguini1 I built your branch in Docker, $ cat nuttx/config.txt
kernel=nuttx.bin
arm_64bit=1
core_freq_min=500Which is probably generated by this Makefile in your PR: Lines 31 to 39 in b6b89a4 Could you delete config.txt after building NuttX? I think the CI Build will complain no more after we fix this :-)
FYI Here's how I built your branch in Docker: |
Unfortunately the config.txt is generated because it's needed for the Raspberry Pi 4B to boot, it needs to be copied onto the Pi's SD card. If I add it to the files that are cleaned on |
|
@linguini1 Wonder if we could generate Or we add |
The content actually won't be static; it depends on the Kconfig options. For instance, right now the user can select the Kconfig option I could generate it so that it stays in |
@linguini1 Hmmm the defconfig check might still fail, if it detects new files in Maybe: We could generate the files inside Sorry I can't think of any good solution right now, and I think it's really good to merge this PR as-is, right now, with minimal tweaks. Wonder if we could hardcode |
Will that work? I had It appears the other POSTBUILD example which generates files in the build directory also defines a |
… BCM2711 and Raspberry Pi 4B. Includes a Mini-UART NSH console for the 4B, tested on the 4GB RAM model. Part of an I2C driver which can only read, boiler-plate for a SPI driver, and a GPIO driver with limited pins. Some tools are present for automatically fetching the boot files and creating the `config.txt` file based on selected Kconfig options.
Yep let's go ahead and try this. Otherwise we fallback to the plain simple |
|
Thank you everyone for guiding me through the build errors! |
|
@linguini1 since you have your "logbook" with the steps you took to do the port, maybe you could submit a simple Guide to be included at https://nuttx.apache.org/docs/latest/guides/index.html The official Porting Guide probably is outdated, so having this other guide while things are kind of fresh in your head could be useful. Maybe later it could be adapted and included in the official Porting Guide. What do you think? |
Yeah I think that's a great idea! I can add it as a case study under the porting guide like Nathan suggested? That way people porting things will stumble upon it? In the next few days I'll clean up my logs in a way that they can be posted and open a PR. |
Summary
Closes #11586.
This PR adds semi-functional support for the BCM2711 and Raspberry Pi 4B. The working features are a Mini-UART shell which can boot into NSH. I have run OStest and confirmed it works. The latest changes also boot.
Impact
Although the feature implementation for this board is minimal right now, I hope that by releasing the work I've done so far it is easier for other community members to start adding drivers/features to the board's support on NuttX. Several people were interested in using the Pi 4B with NuttX and it's a reasonably popular development board, so having it fully supported will be an asset.
Testing
Built the documentation, ensured it looks correct.
Built the written code so far, which was tested by:
echo 1 > /dev/gpio23and checking with a multimeter that the GPIO has gone high, or connecting input to a GPIO and performingcat /dev/gpio23, etc.OStest results log are attached
ostest-bcm2711.txt