circuitpython/ports/silabs
silabs-BelaV 4e25a4f6b3
Silabs' new Pull Request for submoduling the ports/silabs/tools/slc_cli_linux/ (#7874)
Doing a squash merge to avoid having the `slc_cli_linux` .zip files in the history. They were added in one commit and removed and replaced with a submodule in another.

* Initial commit for xg24

* Fix SLC issue

* Fix SLC extract fail

* Change board's name

* Correct spelling of code

Build immediately after slc generate

* Remove VID and PID

* Change creator and creation id

* Apply new creator_id and creation_id

* Update makefile, error message, mcu_processor function

* Update mpconfigboard.mk

* Update Board extensions, PORT_DEPS

* Update makefile

* Add exclude_patterns

* Show java, jinja2 version

* Show path for debugging CI

* Add requirements-dev for slc

* Add PATH slc_cli

* Update background function

* Add jinja2 PATH

* Show PATH

* Update jinja2 path

* Update jinja2 path

* Update jinja2 path

* Update jinja2 path

* Change slc folder

* Change markupsafe folder

* Add symbolic link for slc

* Update makefile

* Update makefile

* Update MX25R3235F.toml from submodule nvm.toml

* alphabetize the list

* Remove slc_cli_linux folder

* Update slc_cli submodule

---------

Co-authored-by: Chat Nguyen <cvnguyen@silabs.com>
Co-authored-by: silabs-ChatNguyen <chat.nguyen@silabs.com>
Co-authored-by: silabs-ChatNguyen <126220343+silabs-ChatNguyen@users.noreply.github.com>
2023-04-18 12:42:16 -04:00
..
boards Silabs' new Pull Request for submoduling the ports/silabs/tools/slc_cli_linux/ (#7874) 2023-04-18 12:42:16 -04:00
common-hal Silabs' new Pull Request for submoduling the ports/silabs/tools/slc_cli_linux/ (#7874) 2023-04-18 12:42:16 -04:00
cp_efr32_extension Silabs' new Pull Request for submoduling the ports/silabs/tools/slc_cli_linux/ (#7874) 2023-04-18 12:42:16 -04:00
gecko_sdk@3fbadf9fb4 Silabs' new Pull Request for submoduling the ports/silabs/tools/slc_cli_linux/ (#7874) 2023-04-18 12:42:16 -04:00
peripherals Silabs' new Pull Request for submoduling the ports/silabs/tools/slc_cli_linux/ (#7874) 2023-04-18 12:42:16 -04:00
res Silabs' new Pull Request for submoduling the ports/silabs/tools/slc_cli_linux/ (#7874) 2023-04-18 12:42:16 -04:00
supervisor Silabs' new Pull Request for submoduling the ports/silabs/tools/slc_cli_linux/ (#7874) 2023-04-18 12:42:16 -04:00
tools Silabs' new Pull Request for submoduling the ports/silabs/tools/slc_cli_linux/ (#7874) 2023-04-18 12:42:16 -04:00
Makefile Silabs' new Pull Request for submoduling the ports/silabs/tools/slc_cli_linux/ (#7874) 2023-04-18 12:42:16 -04:00
README.md Silabs' new Pull Request for submoduling the ports/silabs/tools/slc_cli_linux/ (#7874) 2023-04-18 12:42:16 -04:00
background.c Silabs' new Pull Request for submoduling the ports/silabs/tools/slc_cli_linux/ (#7874) 2023-04-18 12:42:16 -04:00
background.h Silabs' new Pull Request for submoduling the ports/silabs/tools/slc_cli_linux/ (#7874) 2023-04-18 12:42:16 -04:00
circuitpython_efr32.slcp Silabs' new Pull Request for submoduling the ports/silabs/tools/slc_cli_linux/ (#7874) 2023-04-18 12:42:16 -04:00
license.md Silabs' new Pull Request for submoduling the ports/silabs/tools/slc_cli_linux/ (#7874) 2023-04-18 12:42:16 -04:00
mpconfigport.h Silabs' new Pull Request for submoduling the ports/silabs/tools/slc_cli_linux/ (#7874) 2023-04-18 12:42:16 -04:00
mpconfigport.mk Silabs' new Pull Request for submoduling the ports/silabs/tools/slc_cli_linux/ (#7874) 2023-04-18 12:42:16 -04:00
mphalport.c Silabs' new Pull Request for submoduling the ports/silabs/tools/slc_cli_linux/ (#7874) 2023-04-18 12:42:16 -04:00
mphalport.h Silabs' new Pull Request for submoduling the ports/silabs/tools/slc_cli_linux/ (#7874) 2023-04-18 12:42:16 -04:00
qstrdefsport.h Silabs' new Pull Request for submoduling the ports/silabs/tools/slc_cli_linux/ (#7874) 2023-04-18 12:42:16 -04:00
silabs.pintool Silabs' new Pull Request for submoduling the ports/silabs/tools/slc_cli_linux/ (#7874) 2023-04-18 12:42:16 -04:00

README.md

Circuitpython on EFR32

GitHub GitHub GitHub GitHub GitHub GitHub

This port brings the Silicon Labs EFR32 series of MCUs to Circuitpython.

Refer to mpconfigport.mk for a full list of enabled modules sorted by family.

How this port is organized:

  • boards/ contains the configuration files for each development board and breakout available on the port, as well as system files and both shared and SoC-specific linker files. Board configuration includes a pin mapping of the board, oscillator information, board-specific build flags, and setup for some other peripheral where applicable.
  • common-hal/ contains the port-specific module implementations, used by shared-module and shared-bindings.
  • peripherals/ contains peripheral setup files and peripheral mapping information, sorted by family and sub-variant. Most files in this directory can be generated with the python scripts in tools/.
  • supervisor/ contains port-specific implementations of internal flash and serial, as well as the port.c file, which initializes the port at startup.
  • tools/ contains Silicon Labs configurator (SLC) tool, python scripts for generating peripheral and pin mapping files in peripherals/ and board/.

At the root level, refer to mpconfigboard.h and mpconfigport.mk for port specific settings and a list of enabled modules.

Prerequisites

Please ensure you set up your build environment appropriately, as per the guide. You will need:

Install necessary packages

$ sudo apt install default-jre gcc-arm-none-eabi wget python3 python3-pip git git-lfs gettext uncrustify
$ sudo python -m pip install --upgrade pip

Board supported

Board Code Build CMD
xG24 Dev Kit brd2601b devkit_xg24_brd2601b
xG24 Explorer Kit brd2703a explorerkit_xg24_brd2703a
Sparkfun Thing Plus MGM240P brd2704a sparkfun_thingplus_matter_mgm240p_brd2704a

Build instructions

Ensure your clone of Circuitpython is ready to build by following the guide on the Adafruit Website. This includes installing the toolchain, synchronizing submodules, and running mpy-cross.

Clone the source code of CircuitPython from Github:

$  git clone https://github.com/SiliconLabs/circuitpython.git
$  cd circuitpython
$  make fetch-submodules

Checkout the branch or tag you want to build. For example:

$  git checkout main

Following the guideline below to install required packages for SLC tool: https://www.silabs.com/documents/public/user-guides/ug520-software-project-generation-configuration-with-slc-cli.pdf

Once the one-time build tasks are complete, you can build at any time by navigating to the port directory:

$ make BOARD=explorerkit_xg24_brd2703a

You may also build with certain flags available in the makefile, depending on your board and development goals:

$ make BOARD=explorerkit_xg24_brd2703a DEBUG=1

Clean project by using:

$ make BOARD=explorerkit_xg24_brd2703a clean

Bring-up on the board

Getting a REPL prompt

Connect the devkit to the PC via the USB cable. The board usesserial for REPL access and debugging because the EFR32 chips has no USB support.

Windows

On Windows, we need to install a serial console e.g., PuTTY, MobaXterm. The JLink CDC UART Port can be found in the DeviceManager.

Linux

Open a terminal and issue the following command:

$ ls /dev/ttyACM*

Then note down the correct name and substitutecom-port-namein the following command with it:

$ screen /dev/'com-port-name'

Using the REPL prompt

After flashing the firmware to the board, at your first connecting to the board, you might see a blank screen. Press enter and you should be presented with a Circuitpython prompt,>>>. If not, try to reset the board (see instructions below).

You can now type in simple commands such as:

>>> print("Hello world!")

Hello world

If something goes wrong with the board, you can reset it. Pressing CTRL+D when the prompt is open performs a soft reset.

Thonny is a simple code editor that works with the Adafruit CircuitPython boards.

Config serial: Tools > Options > Interpreter > Select MicroPython > Select Port Jlink CDC UART Port

Running CircuitPython scripts

At the boot stage, two scripts will be run (if not booting in safe mode). First, the file boot.py will be executed.The file boot.py can be used to perform the initial setup. Then, afterboot.pyhas been completed, the filecode.py will be executed.

Aftercode.pyhas finished executing, a REPL prompt will be presented on the serial port. Other files can also be executed by using the Thonny editors or using Ampy tool.

Thony

With the boards which support USB mass storage, we can drag the files to the board file system. However, because the EFR32 boards dont support USB mass storage, we need to use a tool like Ampy to copy the file to the board. You can use the latest version of Ampy and its commandto copy the module directories to the board.

Refer to the guideline below for installing the Ampy tool:

https://learn.adafruit.com/micropython-basics-load-files-and-run-code/install-ampy

Modules supported

Board Modules Available
xG24 Dev Kit _asyncio, _bleio, _pixelmap, adafruit_ble, adafruit_bus_device, adafruit_pixelbuf, adafruit_register, aesio,analogio, array, atexit, binascii, bitmaptools, board, builtins, busio, collections, digitalio, displayio,errno, fontio, framebufferio, gc, getpass, gifio, json, math, microcontroller, micropython, msgpack, nvm, onewireio, os, pwmio, rainbowio, random, re, rtc, select, sharpdisplay, storage, struct, supervisor, sys, terminalio, time, traceback, ulab, uselect, vectorio, watchdog, zlib
xG24 Explorer Kit _asyncio, _bleio, _pixelmap, adafruit_ble, adafruit_bus_device, adafruit_pixelbuf, adafruit_register, aesio,analogio, array, atexit, binascii, bitmaptools, board, builtins, busio, collections, digitalio, displayio,errno, fontio, framebufferio, gc, getpass, gifio, json, math, microcontroller, micropython, msgpack, nvm, onewireio, os, pwmio, rainbowio, random, re, rtc, sdcardio, select, sharpdisplay, storage, struct, supervisor, sys, terminalio, time, traceback, ulab, uselect, vectorio, watchdog, zlib
Sparkfun Thing Plus MGM240P _asyncio, _bleio, _pixelmap, adafruit_ble, adafruit_bus_device, adafruit_pixelbuf, adafruit_register, aesio,analogio, array, atexit, binascii, bitmaptools, board, builtins, busio, collections, digitalio, displayio,errno, fontio, framebufferio, gc, getpass, gifio, json, math, microcontroller, micropython, msgpack, nvm, onewireio, os, pwmio, rainbowio, random, re, rtc, sdcardio, select, sharpdisplay, storage, struct, supervisor, sys, terminalio, time, traceback, ulab, uselect, vectorio, watchdog, zlib