Merge pull request #8484 from tannewt/improve_silabs

A few silabs improvements
This commit is contained in:
Scott Shawcroft 2023-10-17 11:37:31 -07:00 committed by GitHub
commit fce45af820
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 35 additions and 34 deletions

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 $(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;
}
}