Merge remote-tracking branch 'adafruit/main' into v1.21-merge

This commit is contained in:
Dan Halbert 2023-10-19 11:20:25 -04:00
commit a8fb081166
17 changed files with 188 additions and 43 deletions

View File

@ -25,7 +25,7 @@ runs:
inputs.port != 'espressif'
uses: carlosperate/arm-none-eabi-gcc-action@v1
with:
release: '10-2020-q4'
release: '12.3.Rel1'
# espressif
- name: Get espressif toolchain

View File

@ -67,7 +67,7 @@ SECTIONS
The program executes knowing that the data is in the RAM
but the loader puts the initial values in the FLASH_FIRMWARE (inidata).
It is one task of the startup to copy the initial values from FLASH_FIRMWARE to RAM. */
.data : AT ( _sidata )
.data :
{
. = ALIGN(4);
_srelocate = .; /* create a global symbol at data start; used by startup code in order to initialize the .data section in RAM */
@ -78,7 +78,7 @@ SECTIONS
. = ALIGN(4);
_erelocate = .; /* define a global symbol at data end; used by startup code in order to initialize the .data section in RAM */
} >RAM
} >RAM AT> FLASH_FIRMWARE
/* Uninitialized data section */
.bss (NOLOAD) :
@ -96,7 +96,7 @@ SECTIONS
} >RAM
/* this just checks there is enough RAM for the requested stack. */
.stack :
.stack (NOLOAD) :
{
. = ALIGN(4);
. = . + ${CIRCUITPY_DEFAULT_STACK_SIZE};

View File

@ -148,7 +148,7 @@ else
$(BUILD)/kernel$(SUFFIX).elf: $(OBJ)
$(STEPECHO) "LINK $@"
$(Q)echo $(OBJ) > $(BUILD)/firmware.objs
$(Q)$(CC) -o $@ $(LDFLAGS) @$(BUILD)/firmware.objs -Wl,--start-group $(LIBS) -Wl,--end-group
$(Q)$(CC) -o $@ $(LDFLAGS) @$(BUILD)/firmware.objs -Wl,--print-memory-usage -Wl,--start-group $(LIBS) -Wl,--end-group
endif
$(BUILD)/kernel$(SUFFIX).img: $(BUILD)/kernel$(SUFFIX).elf

View File

@ -569,7 +569,7 @@ esp-idf-stamp: $(BUILD)/esp-idf/config/sdkconfig.h
$(BUILD)/firmware.elf: $(OBJ) | esp-idf-stamp $(IDF_CMAKE_TARGETS)
$(STEPECHO) "LINK $@"
$(Q)$(CC) -o $@ $(LDFLAGS) $^ -Wl,--start-group $(ESP_IDF_COMPONENTS_EXPANDED) $(BINARY_BLOBS) $(MBEDTLS_COMPONENTS_LINK_EXPANDED) $(LIBS) -Wl,--end-group -u newlib_include_pthread_impl -u ld_include_highint_hdl -u __cxx_fatal_exception
$(Q)$(CC) -o $@ $(LDFLAGS) $^ -Wl,--print-memory-usage -Wl,--start-group $(ESP_IDF_COMPONENTS_EXPANDED) $(BINARY_BLOBS) $(MBEDTLS_COMPONENTS_LINK_EXPANDED) $(LIBS) -Wl,--end-group -u newlib_include_pthread_impl -u ld_include_highint_hdl -u __cxx_fatal_exception
$(BUILD)/circuitpython-firmware.bin: $(BUILD)/firmware.elf | tools/build_memory_info.py
$(STEPECHO) "Create $@"

View File

@ -138,7 +138,7 @@ $(BUILD)/firmware.elf: invalid-board
else
$(BUILD)/firmware.elf: $(OBJ)
$(STEPECHO) "LINK $@"
$(Q)$(CC) -o $@ $(LDFLAGS) $^ -Wl,--start-group $(LIBS) -Wl,--end-group
$(Q)$(CC) -o $@ $(LDFLAGS) $^ -Wl,--print-memory-usage -Wl,--start-group $(LIBS) -Wl,--end-group
$(Q)$(SIZE) $@ | $(PYTHON) $(TOP)/tools/build_memory_info.py $(LD_FILE) $(BUILD)
endif

View File

@ -214,7 +214,7 @@ else
$(BUILD)/firmware.elf: $(OBJ) $(GENERATED_LD_FILE)
$(STEPECHO) "LINK $@"
$(Q)echo $(OBJ) > $(BUILD)/firmware.objs
$(Q)$(CC) -o $@ $(LDFLAGS) @$(BUILD)/firmware.objs -Wl,--start-group $(LIBS) -Wl,--end-group
$(Q)$(CC) -o $@ $(LDFLAGS) @$(BUILD)/firmware.objs -Wl,--print-memory-usage -Wl,--start-group $(LIBS) -Wl,--end-group
$(Q)$(SIZE) $@ | $(PYTHON) $(TOP)/tools/build_memory_info.py $(GENERATED_LD_FILE) $(BUILD)
endif

View File

@ -0,0 +1,29 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2017 Scott Shawcroft for Adafruit Industries
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "supervisor/board.h"
// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here.

View File

@ -0,0 +1,45 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2016 Glenn Ruben Bakke
* Copyright (c) 2018 Dan Halbert for Adafruit Industries
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "nrfx/hal/nrf_gpio.h"
#define MICROPY_HW_BOARD_NAME "SuperMini NRF52840"
#define MICROPY_HW_MCU_NAME "nRF52840"
#define MICROPY_HW_LED_STATUS (&pin_P0_15)
#define BOARD_HAS_CRYSTAL 1
#define DEFAULT_I2C_BUS_SCL (&pin_P0_20)
#define DEFAULT_I2C_BUS_SDA (&pin_P0_17)
#define DEFAULT_SPI_BUS_SCK (&pin_P1_13)
#define DEFAULT_SPI_BUS_MOSI (&pin_P0_10)
#define DEFAULT_SPI_BUS_MISO (&pin_P1_11)
#define DEFAULT_UART_BUS_RX (&pin_P0_08)
#define DEFAULT_UART_BUS_TX (&pin_P0_06)

View File

@ -0,0 +1,8 @@
USB_VID = 0x1209
USB_PID = 0xADF0
USB_PRODUCT = "SuperMini NRF52840"
USB_MANUFACTURER = "ICBbuy"
MCU_CHIP = nrf52840
INTERNAL_FLASH_FILESYSTEM = 1

View File

@ -0,0 +1,62 @@
#include "shared-bindings/board/__init__.h"
STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS
{ MP_ROM_QSTR(MP_QSTR_P0_02), MP_ROM_PTR(&pin_P0_02) },
{ MP_ROM_QSTR(MP_QSTR_P0_04), MP_ROM_PTR(&pin_P0_04) },
{ MP_ROM_QSTR(MP_QSTR_P0_06), MP_ROM_PTR(&pin_P0_06) },
{ MP_ROM_QSTR(MP_QSTR_P0_08), MP_ROM_PTR(&pin_P0_08) },
{ MP_ROM_QSTR(MP_QSTR_P0_09), MP_ROM_PTR(&pin_P0_09) },
{ MP_ROM_QSTR(MP_QSTR_P0_10), MP_ROM_PTR(&pin_P0_10) },
{ MP_ROM_QSTR(MP_QSTR_P0_11), MP_ROM_PTR(&pin_P0_11) },
{ MP_ROM_QSTR(MP_QSTR_P0_12), MP_ROM_PTR(&pin_P0_12) },
{ MP_ROM_QSTR(MP_QSTR_P0_13), MP_ROM_PTR(&pin_P0_13) },
{ MP_ROM_QSTR(MP_QSTR_P0_15), MP_ROM_PTR(&pin_P0_15) },
{ MP_ROM_QSTR(MP_QSTR_P0_17), MP_ROM_PTR(&pin_P0_17) },
{ MP_ROM_QSTR(MP_QSTR_P0_20), MP_ROM_PTR(&pin_P0_20) },
{ MP_ROM_QSTR(MP_QSTR_P0_22), MP_ROM_PTR(&pin_P0_22) },
{ MP_ROM_QSTR(MP_QSTR_P0_24), MP_ROM_PTR(&pin_P0_24) },
{ MP_ROM_QSTR(MP_QSTR_P0_26), MP_ROM_PTR(&pin_P0_26) },
{ MP_ROM_QSTR(MP_QSTR_P0_29), MP_ROM_PTR(&pin_P0_29) },
{ MP_ROM_QSTR(MP_QSTR_P0_31), MP_ROM_PTR(&pin_P0_31) },
{ MP_ROM_QSTR(MP_QSTR_P1_00), MP_ROM_PTR(&pin_P1_00) },
{ MP_ROM_QSTR(MP_QSTR_P1_01), MP_ROM_PTR(&pin_P1_01) },
{ MP_ROM_QSTR(MP_QSTR_P1_02), MP_ROM_PTR(&pin_P1_02) },
{ MP_ROM_QSTR(MP_QSTR_P1_04), MP_ROM_PTR(&pin_P1_04) },
{ MP_ROM_QSTR(MP_QSTR_P1_06), MP_ROM_PTR(&pin_P1_06) },
{ MP_ROM_QSTR(MP_QSTR_P1_07), MP_ROM_PTR(&pin_P1_07) },
{ MP_ROM_QSTR(MP_QSTR_P1_11), MP_ROM_PTR(&pin_P1_11) },
{ MP_ROM_QSTR(MP_QSTR_P1_13), MP_ROM_PTR(&pin_P1_13) },
{ MP_ROM_QSTR(MP_QSTR_P1_15), MP_ROM_PTR(&pin_P1_15) },
{ MP_ROM_QSTR(MP_QSTR_AIN0), MP_ROM_PTR(&pin_P0_02) },
{ MP_ROM_QSTR(MP_QSTR_AIN2), MP_ROM_PTR(&pin_P0_04) },
{ MP_ROM_QSTR(MP_QSTR_AIN5), MP_ROM_PTR(&pin_P0_29) },
{ MP_ROM_QSTR(MP_QSTR_AIN7), MP_ROM_PTR(&pin_P0_31) },
{ MP_ROM_QSTR(MP_QSTR_NFC1), MP_ROM_PTR(&pin_P0_09) },
{ MP_ROM_QSTR(MP_QSTR_NFC2), MP_ROM_PTR(&pin_P0_10) },
{ MP_ROM_QSTR(MP_QSTR_BAT_VOLT), MP_ROM_PTR(&pin_P0_04) }, // Read battery voltage
{ MP_ROM_QSTR(MP_QSTR_VCC_OFF), MP_ROM_PTR(&pin_P0_13) }, // Turn off external VCC by MOSFET
{ MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_P0_15) }, // Controls blue LED, high is on
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_P0_08) },
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_P0_06) },
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_P0_20) },
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_P0_17) },
{ MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_P1_13) },
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_P0_10) },
{ MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_P1_11) },
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
};
MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);

View File

@ -24,7 +24,7 @@
#
.SUFFIXES: # ignore builtin rules
.PHONY: all clean slc-clean slc-generate dependents
.PHONY: all clean slc-clean slc-generate dependents flash
# Values set by the initial generation
PROJECTNAME = circuitpython_efr32
# If the build directory is not given, make it reflect the board name.
@ -142,10 +142,13 @@ $(SILABS_BUILD)/$(PROJECTNAME).Makefile: | $(HEADER_BUILD)/mpversion.h
+@$(MAKE) --no-print-directory slc-generate
$(OUTPUT_DIR)/firmware.out: $(SILABS_BUILD)/pin_functions.h $(SILABS_BUILD)/pins.c $(OBJ) $(OBJS) $(LIB_FILES)
@echo 'Linking $(OUTPUT_DIR)/firmware.out'
@echo "$(OBJS) $(OBJ)" > $(OUTPUT_DIR)/linker_objs
$(CC) $(LD_FLAGS) @$(OUTPUT_DIR)/linker_objs $(LIBS) -o $(OUTPUT_DIR)/firmware.out
$(OBJCOPY) $(OUTPUT_DIR)/firmware.out -O binary $(OUTPUT_DIR)/firmware.bin
$(STEPECHO) 'Linking $(OUTPUT_DIR)/firmware.out'
$(Q)echo "$(OBJS) $(OBJ)" > $(OUTPUT_DIR)/linker_objs
$(Q)$(CC) $(LD_FLAGS) @$(OUTPUT_DIR)/linker_objs -Wl,--print-memory-usage $(LIBS) -o $(OUTPUT_DIR)/firmware.out
$(Q)$(OBJCOPY) $(OUTPUT_DIR)/firmware.out -O binary $(OUTPUT_DIR)/firmware.bin
flash: $(OUTPUT_DIR)/firmware.bin
$(Q)commander flash -d EFR32MG24 --address 08000000 $(OUTPUT_DIR)/firmware.bin
$(OUTPUT_DIR)/firmware.hex:
@ -174,37 +177,11 @@ endif
@sed -i 's/ autogen\// $(SILABS_BUILD)\/autogen\//g' $(SILABS_BUILD)/circuitpython_efr32.project.mak
@sed -i 's/-T"autogen\//-T"$(SILABS_BUILD)\/autogen\//g' $(SILABS_BUILD)/circuitpython_efr32.project.mak
# tools/slc_cli_linux/bin/slc-cli/developer/exporter_templates/arm_gcc/arm_gcc.Makefile defines
# ECHO = @
# which is not compatible with py/mkenv.mk:
# tools/slc_cli_linux/bin/slc-cli/developer/exporter_templates/arm_gcc/arm_gcc.Makefile includes
# build rules and defines ECHO = @ when VERBOSE = 1 which is not compatible with py/mkenv.mk:
# ECHO = @echo
# so override ECHO
$(OBJS): ECHO =
$(OBJS): ECHO = $(Q)
#$(OBJS):
$(OUTPUT_DIR)/%.o: %.c
#@echo 'Building $<'
@$(MKDIR_P) $(@D)
@$(CC) $(CFLAGS) -c -o $@ $<
$(OUTPUT_DIR)/%.o: %.cpp
#@echo 'Building $<'
@$(MKDIR_P) $(@D)
@$(CXX) $(CXXFLAGS) -c -o $@ $<
$(OUTPUT_DIR)/%.o: %.cc
#@echo 'Building $<'
@$(MKDIR_P) $(@D)
@$(CXX) $(CXXFLAGS) -c -o $@ $<
$(OUTPUT_DIR)/%.o: %.s
#@echo 'Building $<'
@$(MKDIR_P) $(@D)
@$(CC) $(ASMFLAGS) -c -o $@ $<
$(OUTPUT_DIR)/%.o: %.S
#@echo 'Building $<'
@$(MKDIR_P) $(@D)
@$(CC) $(ASMFLAGS) -c -o $@ $<
include $(TOP)/py/mkrules.mk

View File

@ -34,6 +34,8 @@ 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
**Note** that this uses git lfs and will not link without it. The error is something like "Unknown file format" because git lfs has a text placeholder file.
## Supported boards ##
| Board | Code | Build CMD |
@ -71,6 +73,13 @@ Clean the project by using:
make BOARD=explorerkit_xg24_brd2703a clean
## Flashing CircuitPython
Flash the project by using [Simplicity Commander](https://community.silabs.com/s/article/simplicity-commander?language=en_US):
make BOARD=explorerkit_xg24_brd2703a flash
## Running CircuitPython ##
### Connecting to the Serial Console ###

View File

@ -34,6 +34,10 @@
#define BOARD_HSE_SOURCE (RCC_HSE_BYPASS)
#define BOARD_HAS_LOW_SPEED_CRYSTAL (0)
#define CIRCUITPY_RGB_STATUS_R (&pin_PD2)
#define CIRCUITPY_RGB_STATUS_G (&pin_PA4)
#define CIRCUITPY_RGB_STATUS_B (&pin_PB0)
// On-board flash
#define SPI_FLASH_MOSI_PIN (&pin_PC3)
#define SPI_FLASH_MISO_PIN (&pin_PC2)

View File

@ -37,6 +37,8 @@
#define BOARD_HSE_SOURCE (RCC_HSE_BYPASS)
#define BOARD_HAS_LOW_SPEED_CRYSTAL (0)
#define MICROPY_HW_LED_STATUS (&pin_PA4)
#define DEFAULT_I2C_BUS_SDA (&pin_PC5)
#define DEFAULT_I2C_BUS_SCL (&pin_PC4)
#define DEFAULT_I2C_PERIPHERAL I2C0

View File

@ -34,6 +34,8 @@
#define BOARD_HSE_SOURCE (RCC_HSE_BYPASS)
#define BOARD_HAS_LOW_SPEED_CRYSTAL (0)
#define MICROPY_HW_LED_STATUS (&pin_PA8)
#define DEFAULT_I2C_BUS_SDA (&pin_PB4)
#define DEFAULT_I2C_BUS_SCL (&pin_PB3)
#define DEFAULT_I2C_PERIPHERAL I2C0

View File

@ -33,11 +33,16 @@
#include "em_wdog.h"
#include "em_cmu.h"
static bool _wdt_init = false;
void common_hal_watchdog_feed(watchdog_watchdogtimer_obj_t *self) {
WDOGn_Feed(DEFAULT_WDOG);
}
void common_hal_watchdog_deinit(watchdog_watchdogtimer_obj_t *self) {
if (!_wdt_init) {
return;
}
WDOG_Enable(false);
}
@ -105,6 +110,8 @@ void common_hal_watchdog_set_timeout(watchdog_watchdogtimer_obj_t *self,
// Initializing watchdog with chosen settings
WDOGn_Init(DEFAULT_WDOG, &wdogInit);
_wdt_init = true;
}
}

View File

@ -270,7 +270,7 @@ else
$(BUILD)/firmware.elf: $(OBJ)
$(STEPECHO) "LINK $@"
$(Q)echo $^ > $(BUILD)/firmware.objs
$(Q)$(CC) -o $@ $(LDFLAGS) @$(BUILD)/firmware.objs -Wl,--start-group $(LIBS) -Wl,--end-group
$(Q)$(CC) -o $@ $(LDFLAGS) @$(BUILD)/firmware.objs -Wl,--print-memory-usage -Wl,--start-group $(LIBS) -Wl,--end-group
$(Q)$(SIZE) $@ | $(PYTHON) $(TOP)/tools/build_memory_info.py $(LD_FILE) $(BUILD)
endif