Skip to content

Silabs xG24 devkits ports #7833

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

Merged
merged 32 commits into from
Apr 17, 2023
Merged

Silabs xG24 devkits ports #7833

merged 32 commits into from
Apr 17, 2023

Conversation

silabs-BelaV
Copy link

Peripheral and Bluetooth support for xG24 explorer kit, xG24 devkit and Sparkfun Thingplus Matter MGM240 board.
Please refer to README.md in ports/silabs for the list of supported modules.

@tannewt
Copy link
Member

tannewt commented Apr 4, 2023

Thank you for opening this pull request! I've ordered the boards so I have ones here to test with. The Discord is the best place to get help with the CI: https://adafru.it/discord

@tannewt
Copy link
Member

tannewt commented Apr 5, 2023

Don't these devices have native USB? You should provide USB VID and PID for them. The creation IDs will be derived from them. No need to add them explicitly.

Copy link
Collaborator

@dhalbert dhalbert left a comment

Choose a reason for hiding this comment

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

Wow! This is an amazing amount of work. My comments are mostly style, because I don't have a board to test.

Comment on lines 1 to 11
# Settings for the Macronix MX25R3235F 32MiB SPI flash.
# Datasheet: https://www.macronix.com/Lists/Datasheet/Attachments/8385/MX25R3235F,%20Wide%20Range,%2032Mb,%20v1.0.pdf
# By default its in lower power mode which can only do 8mhz. In high power mode it can do 80mhz.
total_size = 0x2000000 # 32 MiB
start_up_time_us = 5000
manufacturer_id = 0xc2
memory_type = 0x28
capacity = 0x16
max_clock_speed_mhz = 8
quad_enable_bit_mask = 0x40
has_sector_protection = false
Copy link
Collaborator

Choose a reason for hiding this comment

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

How about submitting this to https://github.com/adafruit/nvm.toml so it can be used by anyone?

Comment on lines 9 to 21
CIRCUITPY_USB = 0
CIRCUITPY_BUSIO = 1
CIRCUITPY_BLEIO = 1
CIRCUITPY_NEOPIXEL_WRITE = 0
CIRCUITPY_FRAMEBUFFERIO = 1
CIRCUITPY_PULSEIO = 0
CIRCUITPY_PWMIO = 1
CIRCUITPY_DISPLAYIO = 1
CIRCUITPY_BLEIO_HCI = 0
CIRCUITPY_SDCARDIO = 1
CIRCUITPY_I2CTARGET = 0
CIRCUITPY_DIGITALIO = 1
CIRCUITPY_ANALOGIO = 1
Copy link
Collaborator

Choose a reason for hiding this comment

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

Alphabetize


void common_hal_watchdog_set_timeout(watchdog_watchdogtimer_obj_t *self,
mp_float_t new_timeout) {
if ((uint64_t)new_timeout > 256) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd do a float comparison here, because some floats will not fit even in 64 bits.

CIRCUITPY_I2CPERIPHERAL ?= 0
CIRCUITPY_ROTARYIO ?= 0
USB_NUM_ENDPOINT_PAIRS = 0
UF2_FAMILY_ID ?= 0x57755a57
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm confused; I thought these boards don't have native USB support, so there is no UF2 support?

@silabs-ChatNguyen
Copy link

Hello @dhalbert , @tannewt,
Thanks for your review. I will improve them and commit again.
I have a question about building CI. Set matrix run failed.
Can we run the ci_set_matrix.py file locally before committing? Do you have any suggestions for me?

@tannewt
Copy link
Member

tannewt commented Apr 6, 2023

Hello @dhalbert , @tannewt, Thanks for your review. I will improve them and commit again. I have a question about building CI. Set matrix run failed. Can we run the ci_set_matrix.py file locally before committing? Do you have any suggestions for me?

I just ran it locally from the main branch.

I think you need to add the silabs port to this list: https://github.com/adafruit/circuitpython/blob/main/docs/shared_bindings_matrix.py#L34

When it comes to CI fixes, I generally just test by pushing. That way it'll match it is run in reality.

@RetiredWizard
Copy link

I am trying to build from this PR and got the following:

In file included from ../../py/obj.h:33,
                 from ./mphalport.h:30,
                 from ../../py/mphal.h:35,
                 from ./common-hal/microcontroller/Pin.h:30,
                 from ../../shared-bindings/microcontroller/Pin.h:30,
                 from /home/pi/circuitpython/ports/silabs/gecko_sdk/../boards/sparkfun_thingplus_matter_mgm240p_brd2704a/board.c:28:
../../py/qstr.h:42:14: fatal error: genhdr/qstrdefs.enum.h: No such file or directory
   42 |     #include "genhdr/qstrdefs.enum.h"
      |              ^~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

I am using the Debian 10.2.1 202110110 gcc rather than gcc-arm-none-eabi-10.3-2021.10-x86_64-linux specified in the readme but that doesn't look to me like the problem here.

@silabs-ChatNguyen
Copy link

RetiredWi
Hi @RetiredWizard
Could you pull code and try again with ubuntu or rebuild without option -j ?
make BOARD=explorerkit_xg24_brd2703a slc-clean (clean code)
make BOARD=explorerkit_xg24_brd2703a V=2 (without -j )

@tannewt
Copy link
Member

tannewt commented Apr 11, 2023

To fix the doc build, you'll want to exclude your directory from ReadTheDocs here: https://github.com/adafruit/circuitpython/blob/main/conf.py#L167

@RetiredWizard
Copy link

Thanks @silabs-ChatNguyen, sorry for my delayed response. This week is a bit hectic with some travel thrown in the mix. It doesn't look like I'll be back home again to pick this up until early next week.

Could you pull code and try again with ubuntu or rebuild without option -j ?
make BOARD=explorerkit_xg24_brd2703a slc-clean (clean code)
make BOARD=explorerkit_xg24_brd2703a V=2 (without -j )

I did pull the code again this evening and tried without the -j option. I think the build got further this time:

arm-none-eabi-gcc -mcpu=cortex-m33 -mthumb -mfpu=fpv5-sp-d16 -mfloat-abi=hard -T"build-sparkfun_thingplus_matter_mgm240p_brd2704a/autogen/linkerfile.ld" --specs=nano.specs -Xlinker -Map=build-sparkfun_thingplus_matter_mgm240p_brd2704a/circuitpython_efr32.map -Wl,--gc-sections @build-sparkfun_thingplus_matter_mgm240p_brd2704a/linker_objs -Wl,--start-group -lgcc -lc -lm -lnosys /home/pi/circuitpython/ports/silabs/gecko_sdk/protocol/bluetooth/lib/EFR32MG24/GCC/libbluetooth.a /home/pi/circuitpython/ports/silabs/gecko_sdk/platform/emdrv/nvm3/lib/libnvm3_CM33_gcc.a /home/pi/circuitpython/ports/silabs/gecko_sdk/platform/radio/rail_lib/autogen/librail_release/librail_config_mgm240pb32vna_gcc.a /home/pi/circuitpython/ports/silabs/gecko_sdk/platform/radio/rail_lib/autogen/librail_release/librail_multiprotocol_module_efr32xg24_gcc_release.a -Wl,--end-group -o build-sparkfun_thingplus_matter_mgm240p_brd2704a/firmware.out
/home/pi/bin/gcc-arm-none-eabi-10.3-2021.10/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld:/home/pi/circuitpython/ports/silabs/gecko_sdk/protocol/bluetooth/lib/EFR32MG24/GCC/libbluetooth.a: file format not recognized; treating as linker script
/home/pi/bin/gcc-arm-none-eabi-10.3-2021.10/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld:/home/pi/circuitpython/ports/silabs/gecko_sdk/protocol/bluetooth/lib/EFR32MG24/GCC/libbluetooth.a:1: syntax error
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:198: build-sparkfun_thingplus_matter_mgm240p_brd2704a/firmware.out] Error 1
make: *** [Makefile:64: build-sparkfun_thingplus_matter_mgm240p_brd2704a/firmware.bin] Error 2

@tannewt tannewt requested a review from dhalbert April 13, 2023 16:53
@silabs-ChatNguyen
Copy link

Thanks @silabs-ChatNguyen, sorry for my delayed response. This week is a bit hectic with some travel thrown in the mix. It doesn't look like I'll be back home again to pick this up until early next week.

Could you pull code and try again with ubuntu or rebuild without option -j ?
make BOARD=explorerkit_xg24_brd2703a slc-clean (clean code)
make BOARD=explorerkit_xg24_brd2703a V=2 (without -j )

I did pull the code again this evening and tried without the -j option. I think the build got further this time:

arm-none-eabi-gcc -mcpu=cortex-m33 -mthumb -mfpu=fpv5-sp-d16 -mfloat-abi=hard -T"build-sparkfun_thingplus_matter_mgm240p_brd2704a/autogen/linkerfile.ld" --specs=nano.specs -Xlinker -Map=build-sparkfun_thingplus_matter_mgm240p_brd2704a/circuitpython_efr32.map -Wl,--gc-sections @build-sparkfun_thingplus_matter_mgm240p_brd2704a/linker_objs -Wl,--start-group -lgcc -lc -lm -lnosys /home/pi/circuitpython/ports/silabs/gecko_sdk/protocol/bluetooth/lib/EFR32MG24/GCC/libbluetooth.a /home/pi/circuitpython/ports/silabs/gecko_sdk/platform/emdrv/nvm3/lib/libnvm3_CM33_gcc.a /home/pi/circuitpython/ports/silabs/gecko_sdk/platform/radio/rail_lib/autogen/librail_release/librail_config_mgm240pb32vna_gcc.a /home/pi/circuitpython/ports/silabs/gecko_sdk/platform/radio/rail_lib/autogen/librail_release/librail_multiprotocol_module_efr32xg24_gcc_release.a -Wl,--end-group -o build-sparkfun_thingplus_matter_mgm240p_brd2704a/firmware.out
/home/pi/bin/gcc-arm-none-eabi-10.3-2021.10/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld:/home/pi/circuitpython/ports/silabs/gecko_sdk/protocol/bluetooth/lib/EFR32MG24/GCC/libbluetooth.a: file format not recognized; treating as linker script
/home/pi/bin/gcc-arm-none-eabi-10.3-2021.10/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld:/home/pi/circuitpython/ports/silabs/gecko_sdk/protocol/bluetooth/lib/EFR32MG24/GCC/libbluetooth.a:1: syntax error
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:198: build-sparkfun_thingplus_matter_mgm240p_brd2704a/firmware.out] Error 1
make: *** [Makefile:64: build-sparkfun_thingplus_matter_mgm240p_brd2704a/firmware.bin] Error 2

Hello @RetiredWizard
Seem to have a problem when cloning libbluetooth.a file.
You should install git LFS before cloning submodule gecko_sdk.
Please remove submodule gecko_sdk, install git LFS and clone again.

@RetiredWizard
Copy link

@silabs-ChatNguyen Thanks! that did it 😄

Adafruit CircuitPython 8.1.0-beta.0-68-g5c4dfcf59-dirty on 2023-04-15; Sparkfun Thing Plus MGM240P with MGM240PB32VNA

@silabs-ChatNguyen
Copy link

Hello @dhalbert,
I have made some changes based on your previous feedback.
Could you help me to review it again?
Thank you in advance!

Copy link
Collaborator

@dhalbert dhalbert left a comment

Choose a reason for hiding this comment

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

Thank you! -- just a request for three trivial alphabetizations.

@tannewt tannewt requested a review from dhalbert April 17, 2023 15:44
@silabs-ChatNguyen
Copy link

Thank you! -- just a request for three trivial alphabetizations.
Hi @dhalbert @tannewt
I have alphabetized them.
Unfortunately, build CI/docs failed, CI has problems when downloading some required packages.
image
Could you help me to fix this problem?

@tannewt
Copy link
Member

tannewt commented Apr 17, 2023

@silabs-ChatNguyen I reran it. This can happen because GitHub Actions is unreliable.

@silabs-ChatNguyen
Copy link

@tannewt Still fail. Seem CI needs to update the package cache (sudo apt update) before installing the package.

@dhalbert
Copy link
Collaborator

The GitHub Actions bug is a GitHub problem; there's an issue about it: actions/runner-images#7452. I'll merge now anyway, because this should be a transient problem.

Copy link
Collaborator

@dhalbert dhalbert left a comment

Choose a reason for hiding this comment

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

Thank you for this excellent PR!

@dhalbert dhalbert merged commit 1669c56 into adafruit:main Apr 17, 2023
@dhalbert
Copy link
Collaborator

@silabs-BelaV @silabs-ChatNguyen I merged this PR, and then realized that the ports/silabs/tools/slc_cli_linux/* files were 150MB. That is much larger than anything else in this repo. We would really like these files to be somewhere else. Do you have another repo you can submodule them from, or just fetch them as necessary in the Makefile, say?

I undid the merge commit by force-pushing to get rid of the history with these files.

@silabs-BelaV
Copy link
Author

@dhalbert @tannewt @RetiredWizard We appreciate your quick and extensive assistance to merge our pull request, and we are thrilled to have made it to this stage. Our new Pull Request for submoduling the ports/silabs/tools/slc_cli_linux/ is created: #7874

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants