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

Support for the Seeed Studio XIAO SAMD21 #14678

Merged
merged 1 commit into from
Nov 7, 2024

Conversation

linguini1
Copy link
Contributor

Summary

This PR introduces support for the XIAO Seeeduino SAMD21 board. It includes a single configuration for NSH and also documentation about how to program the board.

Impact

The impact of this PR is that another SAMD21 based board is now supported by NuttX. I have not tried the peripherals yet outside of getting NSH to boot and run.

Testing

Configured and compiled the binary using the NuttX build system, converted to a uf2 format file and copied it to the Xiao board over USB. I then connected a TTL cable to the UART pins of the Xiao and confirmed that NuttX boots into NSH. I tried the hello world command and uname.

nsh> uname -a
NuttX 12.7.0 c945d094a0 Nov  6 2024 17:23:03 arm xiao-seeeduino
nsh> 

I wanted to test with OS test, but noticed that there are linker errors with pthreads. I'm wondering if this is a limitation of the chip support?

For documentation, I tested by running make html locally and confirming the absence of errors and warnings, and then opened the docs in my browser to verify formatting.

Questions

For something like the RP2040 based chips which use a UF2 bootloader, the picotool is a dependency for performing the elf to uf2 conversion. I am wondering as per my comment in the documentation, if it would be worth cloning the Microsoft uf2 conversion tool in the post-build configuration steps, and automatically converting the .hex file to a .uf2 file. This might make the process more seamless for users. The project is MIT licensed so I believe it would be okay to refer to from NuttX/use in the build system.

If that seems like a good idea, I can open another PR to perform that conversion later.

@github-actions github-actions bot added Area: Documentation Improvements or additions to documentation Board: arm labels Nov 6, 2024
Copy link

github-actions bot commented Nov 6, 2024

This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size.

@github-actions github-actions bot added the Size: XL The size of the change in this PR is very large. Consider breaking down the PR into smaller pieces. label Nov 6, 2024
@linguini1
Copy link
Contributor Author

I think the build failure isn't related to my changes? It appears to be failing on other PRs as well.

@xiaoxiang781216
Copy link
Contributor

xiaoxiang781216 commented Nov 7, 2024

I think the build failure isn't related to my changes? It appears to be failing on other PRs as well.

Yes, the fix is here: #14663

I wanted to test with OS test, but noticed that there are linker errors with pthreads. I'm wondering if this is a limitation of the chip support?

do you disable CONFIG_DISABLE_PTHREAD in defconfig?

@linguini1
Copy link
Contributor Author

do you disable CONFIG_DISABLE_PTHREAD in defconfig?

Yes, makes sense! I was just modifying the configuration from another SAMD21 board and it appears it has quite a bit disabled.

I've now managed to compile the OS test example and try running it, although it appears to fail an assertion when testing waitpid().

Test waitpid()
waitpid_start_child: Started waitpid_main at PID=5
waitpid_main: PID 5 StaCurrent Version: NuttX  12.7.0 e7f51e1e80 Nov  6 2024 21:14:18 arm
Assertion failed : at file: :0 task: <noname> process: <noname> 0xbba5
R0: 20000430 R1: 00000000 R2: 00000003  R3: 00000000
R4: 20002af0 R5: 00000000 R6: 20000430  FP: 00000000
R8: 00000000 SB: 00000000 SL: 00000000 R11: 00000000
IP: 00000008 SP: 20004cf8 LR: 000030a1  PC: 000030a1
xPSR: 20000000 PRIMASK: 00000001 CONTROL: 00000000
EXC_RETURN: 00000000
User Stack:
  base: 0x20002eb8
  size: 00008120
    sp: 0x20004cf8
0x20004cd8: 20004cf0 000063ff 00000001 20004e70 20004cf8 20002eb8 00001fb8 0000319f
0x20004cf8: 00000000 00012e85 00012e85 0000bba5 00013284 00000006 00000000 00000000
0x20004d18: 20002af0 20000430 00000000 00000000 00000000 7474754e 00000058 20000000
0x20004d38: 0000001c 00000000 20000000 00000001 20000038 00000000 00000000 00005a83
0x20004d58: 20000000 00000038 2e323100 00302e37 00000038 20002cd0 20000038 37650001
0x20004d78: 65313566 30386531 766f4e20 20362020 34323032 3a313220 313a3431 20000038
0x20004d98: 20002c98 00000000 ffffffff 00005a83 6d726198 20002c00 ffffffff 00005b2f
0x20004db8: 00000038 0000656d 00000038 00000000 20000bc0 ffffffff 00000001 000058f3
0x20004dd8: 00000000 0000cfc1 00000000 0000656d 00000019 00010a91 00013808 00000005
0x20004df8: 00000000 20000124 20004e18 0000bc9b 20000b1c 20002eae 00018d5c 20002e80
0x20004e18: 00006f18 00000001 0000000e 00003188 00003d90 00003188 00003ee8 00000000
0x20004e38: 00000000 0000bba5 00000005 20002e80 00000000 00005bab 00000000 20002af0
0x20004e58: 00000000 00003d73 00000000 00000000 00000000 00000000 00000000 00000000
rted
waitpid_start_child: ERROR Failed to start waitpid_main
ostest_main: Exiting with status 256
nsh> waitpid_main: PID 5 exitting with result=14

I haven't modified any underlying chip code, so this may be a pre-existing issue with the SAMD21J18 code. I will have to investigate further; this is the only SAMD21 board I own. Let me know if this blocks this PR.

@xiaoxiang781216 xiaoxiang781216 merged commit 6cf1681 into apache:master Nov 7, 2024
23 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Documentation Improvements or additions to documentation Board: arm 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.

3 participants