Skip to content
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

Add support for the BCM2711 #15188

Draft
wants to merge 173 commits into
base: master
Choose a base branch
from
Draft

Add support for the BCM2711 #15188

wants to merge 173 commits into from

Conversation

linguini1
Copy link
Contributor

@linguini1 linguini1 commented Dec 13, 2024

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:

  • Connecting the RPi 4B to my computer via USB-TTL cable and playing around in the shell
  • Running test programs like OStest and getprime (succeeded)
  • Running i2ctool with some I2C devices connected to the board. I was able to dump the contents of an EEPROM but not much more, I am confused by the I2C register interface and haven't spent enough time to overcome these issues. Partial completeness is noted on the docs page.
  • Tested GPIO driver interface by performing basic operations such as echo 1 > /dev/gpio23 and checking with a multimeter that the GPIO has gone high, or connecting input to a GPIO and performing cat /dev/gpio23, etc.

OStest results log are attached
ostest-bcm2711.txt

@github-actions github-actions bot added Area: Documentation Improvements or additions to documentation Area: Tooling Arch: arm64 Issues related to ARM64 (64-bit) architecture Board: arm64 Size: XL The size of the change in this PR is very large. Consider breaking down the PR into smaller pieces. labels Dec 13, 2024
@linguini1
Copy link
Contributor Author

linguini1 commented Dec 13, 2024

It is going to take me a while to squash all these commits

@acassis
Copy link
Contributor

acassis commented Dec 13, 2024

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?

}

bcm2711_miniuart_wait_send(dev, ch);
#endif // CONSOLE_DEV
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove // CONSOLE_DEV or switch to /* ... */

{
_err("Could not register /dev/console, ret=%d\n", ret);
}
#endif // defined(CONSOLE_DEV)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove // ... or switch to /* ... */


#ifndef __ASSEMBLY__

#endif // __ASSEMBLY__
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove // ... or switch to /* ... */


#endif // __ASSEMBLY__

#endif // __ARCH_ARM64_SRC_BCM2711_BCM2711_SERIAL_H
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here


#define BCM_ARMT_PREDIV_PREDIV (0x3ff << 0)

#endif // __ARCH_ARM64_SRC_BCM2711_ARMTIMER_H
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove // ... or switch to /* ... */


static struct bcm2711_gpio_dev_s g_gpout[BOARD_NGPIOOUT];

#endif // BOARD_NGPIOOUT > 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove // ... or switch to /* ... */


static struct bcm2711_gpio_dev_s g_gpin[BOARD_NGPIOIN];

#endif // BOARD_NGPIOIN > 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove // ... or switch to /* ... */


static struct bcm2711_gpioint_dev_s g_gpint[BOARD_NGPIOINT];

#endif // BOARD_NGPIOINT > 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove // ... or switch to /* ... */

return 0;
}

#endif // BOARD_NGPIOOUT > 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove // ... or switch to /* ... */

return 0;
}

#endif // BOARD_NGPIOIN > 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove // ... or switch to /* ... */

@@ -80,4 +82,6 @@ SAVEMake.defs
SAVEconfig
.aider*
imx9-norimage.img

config.txt
tools/bcm2711/*.dat
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move to tools/bcm2711/.gitignore

@@ -352,6 +366,7 @@ config ARM64_DECODEFIQ
config ARM64_GIC_VERSION
int "GIC version"
default 2 if ARCH_CHIP_A64
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrong alignment, you can move this to the previous line default 2 if ARCH_CHIP_A64 | ARCH_CHIP_BCM2711

#include "chip.h"
#include "hardware/bcm2711_aux.h"

#define CONFIG_BCM2711_SPI // TODO remove
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove, we don't need this. It's already protected by if in Make.defs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Arch: arm64 Issues related to ARM64 (64-bit) architecture Area: Documentation Improvements or additions to documentation Area: Tooling Board: arm64 Size: XL The size of the change in this PR is very large. Consider breaking down the PR into smaller pieces.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Raspberry pi 4 model B support
4 participants