ndoo opened a new pull request, #22309:
URL: https://github.com/apache/nuttx/pull/22309
## Summary
This adds a new ARM7TDMI chip, the PortalPlayer PP502x, and its first board,
the Apple iPod Video (5th generation and 5.5G).
The chip has two ARM7TDMI cores. The port runs the first core from SDRAM and
puts the second core to sleep at start-up, because the ARM7TDMI support of
NuttX is for one core: `arch/arm/src/arm` has no SMP code, and `ARCH_ARM7TDMI`
selects `LIBC_ATOMIC_IRQ` and not `ARCH_HAVE_MULTICPU`. It has the interrupt
controller with both banks, the system timer on Timer 1, `up_udelay()` on the
microsecond counter, UART 0 through the generic 16550 driver as the console,
the switch to the 80 MHz PLL (`CONFIG_PP502X_PLL_BOOST`), the CPU cache
start-up, and idle by stopping the core. The start-up code probes the SDRAM
size (32 MiB or 64 MiB) and the heap takes all of it, so one image serves both
parts. The board has the `nsh` and `ostest` configurations.
The PR has four commits: ARM7TDMI support in the CMake build
(`platform.cmake` and `arm.cmake`, 10 lines; no ARM7TDMI chip had a
`CMakeLists.txt` before and a CMake configuration of one stopped with
"CMAKE_SYSTEM_PROCESSOR not set"), the chip, the board, and the documentation.
No peripheral beyond the console UART has a driver here. The drivers exist
out of tree and will follow, one PR each. The USB device controller is first;
its current state is attached as a diff because it is how the runtime log below
was taken.
| Block | Working out of tree | PR |
| --- | --- | --- |
| USB device controller | Yes (attached diff) | pending |
| ATA controller (hard drive) | Yes | pending |
| I2C | Yes | pending |
| Power management unit (PCF50605) | Yes | pending |
| I2S, with its DMA channel, and the WM8758 codec | Yes | pending |
| Click wheel interface | Yes | pending |
| Piezo speaker | Yes | pending |
| Display (frame buffer) | Yes | pending |
| GPIO | No general driver; the drivers above use their pins directly | - |
| DMA | Only the I2S channel, no general driver | - |
## Impact
* Is new feature added? YES: a new chip (`ARCH_CHIP_PP502X`) and board
(`apple-ipod-video`) with `nsh` and `ostest`.
* Impact on user? NO for other boards. For this board:
* Installing replaces the OS image on the iPod's firmware partition,
using `ipodpatcher`.
* The board page has the steps and says to back up the installed image
first.
* Installing and restoring the backup image by those steps were run on
the unit (see Testing).
* No software reset or power-off in this PR; use the reset gesture (hold
Menu and Select).
* Software reset and power-off work out of tree and will follow with the
power management PR.
* Impact on build? YES.
* Make: new chip and board directories and Kconfig entries only.
* CMake: `platform.cmake` and `arm.cmake` gain the `arm7tdmi` processor
and its flags.
* No other ARM7TDMI chip has a `CMakeLists.txt`, so no existing CMake
build changes.
* CI: `arm-other.dat` gains `/arm/pp502x`, with `nsh` built by CMake.
* Impact on hardware? YES: a new chip and a new board. Nothing existing is
touched.
* Impact on documentation? YES, provided: chip and board pages under
`Documentation/platforms/arm/pp502x/`.
* Impact on security? NO.
* Impact on compatibility? NO.
* Anything else?
* ARM7TDMI selects `ARCH_DCACHE`/`ARCH_ICACHE`, whose CP15 operations
this core lacks; the chip page lists the limits.
* The chip's `CMakeLists.txt` drops `arm_head.S` and `arm_vectortab.S`,
as `Make.defs` does: the start-up file has its own vectors.
## Testing
I confirm that changes are verified on local setup and works as intended:
* Build Host(s): Ubuntu 24.04 (aarch64) in a container on macOS,
`arm-none-eabi-gcc (15:13.2.rel1-2) 13.2.1 20231009`, CMake 3.28.3.
* Target(s): ARM, `apple-ipod-video:nsh` and `apple-ipod-video:ostest`
built with Make, `apple-ipod-video:nsh` built with CMake. Run on an iPod Video
5.5G (MA446LL/A, 64 MiB).
Runtime: I do not have the 30-pin dock cable that carries UART 0, so the
log below is not from the UART console. It is from the chip and board files of
this PR with the attached diff on top (`usb-cdcacm-overlay.diff`: the USB
device controller driver and a `usbnsh` configuration with NSH on a CDC ACM
console and `ostest` as a built-in). That diff is not part of this PR; the
driver will be submitted in a follow-on PR once this one is in. The start-up
code, the SDRAM probe, the cache start-up, the PLL switch, the interrupt
controller, the system timer and the heap are the files of this PR, unchanged.
Install route: the `usbnsh` image was packed with the recipe of the board
page and written with `ipodpatcher -wf`; the boot ROM started it and NSH
answered as in the log below. The image saved beforehand with `ipodpatcher -rf`
was then written back with `-wf`: a second read equals the saved file and the
unit started its previous image again. The previous image on my unit was a boot
loader of mine and not Apple's OS.
Not tested: the UART console on hardware, and so the `nsh` and `ostest`
images exactly as this PR builds them (they ran in an emulator of the device
only); the 5th generation model; a 32 MiB part; toolchains other than GCC;
protected and kernel builds (the port is flat only).
Build (no compiler warnings; `tools/testbuild.sh` with `-e "-Wno-cpp
-Werror"` over the two new CI entries also passes):
```
$ ./tools/configure.sh -l apple-ipod-video:nsh && make
text data bss dec hex filename
148844 944 7584 157372 266bc nuttx
$ ./tools/configure.sh -l apple-ipod-video:ostest && make
text data bss dec hex filename
170472 976 9816 181264 2c410 nuttx
$ cmake -B build -DBOARD_CONFIG=apple-ipod-video:nsh -GNinja && cmake
--build build
text data bss dec hex filename
148840 944 7592 157376 266c0 ../build/nuttx
```
Runtime on the iPod Video 5.5G, over the CDC ACM console
(`apple-ipod-video:usbnsh` of the attached diff). The log was taken before the
rebase onto current master; the commits are otherwise the same. The full log,
1066 lines, is attached as `usbnsh-console.log`:
```
NuttShell (NSH)
nsh> uname -a
NuttX 0.0.0 0 Nov 25 2026 06:51:44 arm apple-ipod-video
nsh> mount -t procfs none /proc
nsh> cat /proc/version
NuttX version 0.0.0 0 Nov 25 2026 06:51:44 apple-ipod-video:usbnsh
nsh> free
total used free maxused maxfree nused nfree name
66825352 17824 66807528 18192 66807192 47 5 Umem
nsh> ps
TID PID PPID PRI POLICY TYPE NPX STATE EVENT SIGMASK
STACK COMMAND
0 0 0 0 FIFO Kthread - Ready
0000000000000000 0002016 Idle_Task
1 0 0 224 RR Kthread - Waiting Semaphore
0000000000000000 0001976 hpwork 0x42888 0x428e0
2 0 0 100 RR Kthread - Waiting Semaphore
0000000000000000 0001976 lpwork 0x42810 0x42868
4 4 0 100 RR Task - Running
0000000000000000 0001992 nsh_main
nsh> ostest
stdio_test: write fd=1
stdio_test: Standard I/O Check: printf
stdio_test: write fd=2
stdio_test: Standard I/O Check: fprintf to stderr
...
user_main: Exiting
ostest_main: Exiting with status 0
nsh> free
total used free maxused maxfree nused nfree name
66825352 17992 66807360 123160 66702472 49 8 Umem
```
Testing logs before change: not applicable, the chip and the board are new.
## PR verification Self-Check
* [x] This PR introduces only one functional change.
* [x] I have updated all required description fields above.
* [x] My PR adheres to Contributing
[Guidelines](https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md) and
[Documentation](https://nuttx.apache.org/docs/latest/contributing/index.html)
(git commit title and message, coding standard, etc).
* [ ] My PR is still work in progress (not ready for review).
* [x] My PR is ready for review and can be safely merged into a codebase.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]