summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReinhard Panhuber <[email protected]>2021-01-18 17:16:25 +0100
committerReinhard Panhuber <[email protected]>2021-01-18 17:16:25 +0100
commit15152b62ce363a44bc748859f9d09ef21216790c (patch)
tree8d8489105e563bbfd5adbb1d4080df9b3ff586c1
parentdff588d7727f63b7e8819a89c259b5edddb079e9 (diff)
parent7aaccd94d2e11ee2329353b4119526c75279b3ba (diff)
Merge remote-tracking branch 'upstream/master' into edpt_ISO_xfer
-rw-r--r--.gitmodules3
-rw-r--r--examples/make.mk5
-rw-r--r--examples/rules.mk15
-rw-r--r--hw/bsp/adafruit_clue/board.mk6
-rw-r--r--hw/bsp/arduino_nano33_ble/board.mk6
-rw-r--r--hw/bsp/circuitplayground_bluefruit/board.mk6
-rw-r--r--hw/bsp/da14695_dk_usb/board.mk2
-rw-r--r--hw/bsp/da1469x_dk_pro/board.mk2
-rw-r--r--hw/bsp/double_m33_express/board.mk6
-rw-r--r--hw/bsp/double_m33_express/double_m33_express.c161
-rw-r--r--hw/bsp/feather_nrf52840_express/board.mk6
-rw-r--r--hw/bsp/feather_nrf52840_sense/board.mk6
-rw-r--r--hw/bsp/itsybitsy_nrf52840/board.mk6
-rw-r--r--hw/bsp/nrf52840_mdk_dongle/board.mk6
-rw-r--r--hw/bsp/pca10056/board.mk6
-rw-r--r--hw/bsp/pca10059/board.mk6
-rw-r--r--hw/bsp/pca10100/board.mk6
-rw-r--r--hw/bsp/raytac_mdbt50q_rx/board.mk6
m---------lib/sct_neopixel0
-rw-r--r--tools/top.mk15
20 files changed, 121 insertions, 154 deletions
diff --git a/.gitmodules b/.gitmodules
index dd55bdc0c..1fefa13f0 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -109,3 +109,6 @@
[submodule "lib/CMSIS_5"]
path = lib/CMSIS_5
url = https://github.com/ARM-software/CMSIS_5.git
+[submodule "lib/sct_neopixel"]
+ path = lib/sct_neopixel
+ url = https://github.com/gsteiert/sct_neopixel
diff --git a/examples/make.mk b/examples/make.mk
index 6743044fd..992a4e60e 100644
--- a/examples/make.mk
+++ b/examples/make.mk
@@ -34,9 +34,14 @@ CXX = $(CROSS_COMPILE)g++
OBJCOPY = $(CROSS_COMPILE)objcopy
SIZE = $(CROSS_COMPILE)size
MKDIR = mkdir
+ifeq ($(CMDEXE),1)
+CP = copy
+RM = del
+else
SED = sed
CP = cp
RM = rm
+endif
#-------------- Source files and compiler flags --------------
diff --git a/examples/rules.mk b/examples/rules.mk
index 37e0e7a19..2274d1cd2 100644
--- a/examples/rules.mk
+++ b/examples/rules.mk
@@ -81,7 +81,11 @@ uf2: $(BUILD)/$(BOARD)-firmware.uf2
OBJ_DIRS = $(sort $(dir $(OBJ)))
$(OBJ): | $(OBJ_DIRS)
$(OBJ_DIRS):
+ifeq ($(CMDEXE),1)
+ @$(MKDIR) $(subst /,\,$@)
+else
@$(MKDIR) -p $@
+endif
$(BUILD)/$(BOARD)-firmware.elf: $(OBJ)
@echo LINK $@
@@ -107,13 +111,6 @@ vpath %.c . $(TOP)
$(BUILD)/obj/%.o: %.c
@echo CC $(notdir $@)
@$(CC) $(CFLAGS) -c -MD -o $@ $<
- @# The following fixes the dependency file.
- @# See http://make.paulandlesley.org/autodep.html for details.
- @# Regex adjusted from the above to play better with Windows paths, etc.
- @$(CP) $(@:.o=.d) $(@:.o=.P); \
- $(SED) -e 's/#.*//' -e 's/^.*: *//' -e 's/ *\\$$//' \
- -e '/^$$/ d' -e 's/$$/ :/' < $(@:.o=.d) >> $(@:.o=.P); \
- $(RM) $(@:.o=.d)
# ASM sources lower case .s
vpath %.s . $(TOP)
@@ -134,7 +131,11 @@ size: $(BUILD)/$(BOARD)-firmware.elf
.PHONY: clean
clean:
+ifeq ($(CMDEXE),1)
+ rd /S /Q $(subst /,\,$(BUILD))
+else
$(RM) -rf $(BUILD)
+endif
# Print out the value of a make variable.
# https://stackoverflow.com/questions/16467718/how-to-print-out-a-variable-in-makefile
diff --git a/hw/bsp/adafruit_clue/board.mk b/hw/bsp/adafruit_clue/board.mk
index d5f7c7cd4..3db045ac0 100644
--- a/hw/bsp/adafruit_clue/board.mk
+++ b/hw/bsp/adafruit_clue/board.mk
@@ -14,9 +14,15 @@ CFLAGS += -Wno-error=undef -Wno-error=unused-parameter -Wno-error=cast-align
# due to tusb_hal_nrf_power_event
GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion)))
+ifeq ($(CMDEXE),1)
+ifeq ($(shell if $(GCCVERSION) geq 8 echo 1), 1)
+CFLAGS += -Wno-error=cast-function-type
+endif
+else
ifeq ($(shell expr $(GCCVERSION) \>= 8), 1)
CFLAGS += -Wno-error=cast-function-type
endif
+endif
# All source paths should be relative to the top level.
LD_FILE = hw/bsp/$(BOARD)/nrf52840_s140_v6.ld
diff --git a/hw/bsp/arduino_nano33_ble/board.mk b/hw/bsp/arduino_nano33_ble/board.mk
index d1d62bdf2..1ee8867e6 100644
--- a/hw/bsp/arduino_nano33_ble/board.mk
+++ b/hw/bsp/arduino_nano33_ble/board.mk
@@ -14,9 +14,15 @@ CFLAGS += -Wno-error=undef -Wno-error=unused-parameter -Wno-error=cast-align
# due to tusb_hal_nrf_power_event
GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion)))
+ifeq ($(CMDEXE),1)
+ifeq ($(shell if $(GCCVERSION) geq 8 echo 1), 1)
+CFLAGS += -Wno-error=cast-function-type
+endif
+else
ifeq ($(shell expr $(GCCVERSION) \>= 8), 1)
CFLAGS += -Wno-error=cast-function-type
endif
+endif
# All source paths should be relative to the top level.
#LD_FILE = hw/bsp/$(BOARD)/linker_script.ld
diff --git a/hw/bsp/circuitplayground_bluefruit/board.mk b/hw/bsp/circuitplayground_bluefruit/board.mk
index d5f7c7cd4..3db045ac0 100644
--- a/hw/bsp/circuitplayground_bluefruit/board.mk
+++ b/hw/bsp/circuitplayground_bluefruit/board.mk
@@ -14,9 +14,15 @@ CFLAGS += -Wno-error=undef -Wno-error=unused-parameter -Wno-error=cast-align
# due to tusb_hal_nrf_power_event
GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion)))
+ifeq ($(CMDEXE),1)
+ifeq ($(shell if $(GCCVERSION) geq 8 echo 1), 1)
+CFLAGS += -Wno-error=cast-function-type
+endif
+else
ifeq ($(shell expr $(GCCVERSION) \>= 8), 1)
CFLAGS += -Wno-error=cast-function-type
endif
+endif
# All source paths should be relative to the top level.
LD_FILE = hw/bsp/$(BOARD)/nrf52840_s140_v6.ld
diff --git a/hw/bsp/da14695_dk_usb/board.mk b/hw/bsp/da14695_dk_usb/board.mk
index 8fef7d10f..b097262dc 100644
--- a/hw/bsp/da14695_dk_usb/board.mk
+++ b/hw/bsp/da14695_dk_usb/board.mk
@@ -21,7 +21,7 @@ SRC_C += \
$(MCU_FAMILY_DIR)/src/da1469x_clock.c \
$(MCU_FAMILY_DIR)/src/hal_gpio.c \
-SRC_S += $(TOP)/hw/bsp/$(BOARD)/gcc_startup_da1469x.S
+SRC_S += hw/bsp/$(BOARD)/gcc_startup_da1469x.S
INC += \
$(TOP)/hw/bsp/$(BOARD) \
diff --git a/hw/bsp/da1469x_dk_pro/board.mk b/hw/bsp/da1469x_dk_pro/board.mk
index 60a62378c..16bd6de6b 100644
--- a/hw/bsp/da1469x_dk_pro/board.mk
+++ b/hw/bsp/da1469x_dk_pro/board.mk
@@ -21,7 +21,7 @@ SRC_C += \
$(MCU_FAMILY_DIR)/src/da1469x_clock.c \
$(MCU_FAMILY_DIR)/src/hal_gpio.c \
-SRC_S += $(TOP)/hw/bsp/$(BOARD)/gcc_startup_da1469x.S
+SRC_S += hw/bsp/$(BOARD)/gcc_startup_da1469x.S
INC += \
$(TOP)/hw/bsp/$(BOARD) \
diff --git a/hw/bsp/double_m33_express/board.mk b/hw/bsp/double_m33_express/board.mk
index df42ad4cc..c3401e5b2 100644
--- a/hw/bsp/double_m33_express/board.mk
+++ b/hw/bsp/double_m33_express/board.mk
@@ -25,9 +25,13 @@ SRC_C += \
$(MCU_DIR)/drivers/fsl_power.c \
$(MCU_DIR)/drivers/fsl_reset.c \
$(MCU_DIR)/drivers/fsl_usart.c \
- $(MCU_DIR)/drivers/fsl_flexcomm.c
+ $(MCU_DIR)/drivers/fsl_flexcomm.c \
+ lib/sct_neopixel/sct_neopixel.c
INC += \
+ $(TOP)/hw/bsp/ \
+ $(TOP)/hw/bsp/$(BOARD) \
+ $(TOP)/lib/sct_neopixel \
$(TOP)/$(MCU_DIR)/../../CMSIS/Include \
$(TOP)/$(MCU_DIR) \
$(TOP)/$(MCU_DIR)/drivers
diff --git a/hw/bsp/double_m33_express/double_m33_express.c b/hw/bsp/double_m33_express/double_m33_express.c
index 187313a41..655f23cc0 100644
--- a/hw/bsp/double_m33_express/double_m33_express.c
+++ b/hw/bsp/double_m33_express/double_m33_express.c
@@ -29,7 +29,9 @@
#include "fsl_gpio.h"
#include "fsl_power.h"
#include "fsl_iocon.h"
+#include "fsl_usart.h"
#include "fsl_sctimer.h"
+#include "sct_neopixel.h"
//--------------------------------------------------------------------+
// Forward USB interrupt events to TinyUSB IRQ Handler
@@ -60,6 +62,8 @@ void USB1_IRQHandler(void)
#define NEOPIXEL_NUMBER 2
#define NEOPIXEL_PORT 0
#define NEOPIXEL_PIN 27
+#define NEOPIXEL_CH 6
+#define NEOPIXEL_TYPE 0
// UART
#define UART_DEV USART0
@@ -80,143 +84,9 @@ void USB1_IRQHandler(void)
#define IOCON_PIO_DIG_FUNC4_EN (IOCON_PIO_DIGITAL_EN | IOCON_PIO_FUNC4) /*!<@brief Digital pin function 2 enabled */
#define IOCON_PIO_DIG_FUNC7_EN (IOCON_PIO_DIGITAL_EN | IOCON_PIO_FUNC7) /*!<@brief Digital pin function 2 enabled */
-//--------------------------------------------------------------------+
-// Neopixel Driver
-//--------------------------------------------------------------------+
-#define NEO_SCT SCT0
-#define NEO_MATCH_PERIOD 0
-#define NEO_MATCH_0 1
-#define NEO_MATCH_1 2
-#define NEO_EVENT_RISE 2
-#define NEO_EVENT_FALL_0 0
-#define NEO_EVENT_FALL_1 1
-#define NEO_EVENT_NEXT 3
-#define NEO_EVENT_START 4
-#define NEO_SCT_OUTPUT 6
-#define NEO_STATE_IDLE 24
-//#define NEO_ARRAY_SIZE (3 * NEOPIXEL_NUMBER)
-
-//volatile uint32_t _neopixel_array[NEO_ARRAY_SIZE] = {0x10, 0x20, 0x30, 0x40, 0x50, 0x60};
-volatile uint32_t _neopixel_array[NEOPIXEL_NUMBER] = {0x404040, 0x202020};
-volatile uint32_t _neopixel_count = 0;
-
-void neopixel_int_handler(void){
- uint32_t eventFlag = NEO_SCT->EVFLAG;
- if (eventFlag & (1 << NEO_EVENT_NEXT)) {
- _neopixel_count += 1;
- if (_neopixel_count < (NEOPIXEL_NUMBER)) {
- NEO_SCT->EV[NEO_EVENT_FALL_0].STATE = 0xFFFFFF & (~_neopixel_array[_neopixel_count]);
- NEO_SCT->CTRL &= ~(SCT_CTRL_HALT_L_MASK);
- }
- }
- NEO_SCT->EVFLAG = eventFlag;
-}
-
-void SCT0_DriverIRQHandler(void){
- neopixel_int_handler();
- SDK_ISR_EXIT_BARRIER;
-}
-
-void neopixel_set(uint32_t pixel, uint32_t color){
- if (pixel < NEOPIXEL_NUMBER) {
- _neopixel_array[pixel] = color;
- }
-}
-
-void neopixel_update(void){
-// while (NEO_SCT->CTRL & SCT_CTRL_HALT_L_MASK);
- _neopixel_count = 0;
- NEO_SCT->EV[NEO_EVENT_FALL_0].STATE = 0xFFFFFF & (~_neopixel_array[0]);
- NEO_SCT->CTRL &= ~(SCT_CTRL_HALT_L_MASK);
-}
-
-
-/*
-void neopixel_int_handler(void){
- uint32_t eventFlag = NEO_SCT->EVFLAG;
-// if ((eventFlag & (1 << NEO_EVENT_NEXT)) && (_neopixel_count < (NEO_ARRAY_SIZE))) {
-// NEO_SCT->EV[NEO_EVENT_FALL_0].STATE = 0xFF & (~_neopixel_array[_neopixel_count]);
- if ((eventFlag & (1 << NEO_EVENT_NEXT)) && (_neopixel_count < (NEOPIXEL_NUMBER))) {
- _neopixel_count += 1;
- NEO_SCT->EV[NEO_EVENT_FALL_0].STATE = 0xFFFFFF & (~_neopixel_array[_neopixel_count]);
- NEO_SCT->EVFLAG = eventFlag;
- NEO_SCT->CTRL &= ~(SCT_CTRL_HALT_L_MASK);
- } else {
- NEO_SCT->EVFLAG = eventFlag;
- }
-}
-
-void SCT0_DriverIRQHandler(void){
- neopixel_int_handler();
- SDK_ISR_EXIT_BARRIER;
-}
-
-void neopixel_update(uint32_t pixel, uint32_t color){
- if (pixel < NEOPIXEL_NUMBER) {
- _neopixel_array[pixel] = color;
- _neopixel_count = 0;
-// NEO_SCT->EV[NEO_EVENT_FALL_0].STATE = 0xFF & (~_neopixel_array[0]);
- NEO_SCT->EV[NEO_EVENT_FALL_0].STATE = 0xFFFFFF & (~_neopixel_array[0]);
- NEO_SCT->CTRL &= ~(SCT_CTRL_HALT_L_MASK);
- }
-}
-*/
-void neopixel_init(void) {
- CLOCK_EnableClock(kCLOCK_Sct0);
- RESET_PeripheralReset(kSCT0_RST_SHIFT_RSTn);
-
- NEO_SCT->CONFIG = (
- SCT_CONFIG_UNIFY(1) |
- SCT_CONFIG_CLKMODE(kSCTIMER_System_ClockMode) |
- SCT_CONFIG_NORELOAD_L(1) );
- NEO_SCT->CTRL = (
- SCT_CTRL_HALT_L(1) |
- SCT_CTRL_CLRCTR_L(1) );
-
- NEO_SCT->MATCH[NEO_MATCH_PERIOD] = 120;
- NEO_SCT->MATCH[NEO_MATCH_0] = 30;
- NEO_SCT->MATCH[NEO_MATCH_1] = 60;
- NEO_SCT->EV[NEO_EVENT_START].STATE = (1 << NEO_STATE_IDLE);
- NEO_SCT->EV[NEO_EVENT_START].CTRL = (
- kSCTIMER_OutputLowEvent | SCT_EV_CTRL_IOSEL(NEO_SCT_OUTPUT) |
- SCT_EV_CTRL_STATELD(1) | SCT_EV_CTRL_STATEV(23));
-// NEO_SCT->EV[NEO_EVENT_RISE].STATE = 0xFE;
- NEO_SCT->EV[NEO_EVENT_RISE].STATE = 0xFFFFFE;
- NEO_SCT->EV[NEO_EVENT_RISE].CTRL = (
- kSCTIMER_MatchEventOnly | SCT_EV_CTRL_MATCHSEL(NEO_MATCH_PERIOD) |
- SCT_EV_CTRL_STATELD(0) | SCT_EV_CTRL_STATEV(31));
- NEO_SCT->EV[NEO_EVENT_FALL_0].STATE = 0x0;
- NEO_SCT->EV[NEO_EVENT_FALL_0].CTRL = (
- kSCTIMER_MatchEventOnly | SCT_EV_CTRL_MATCHSEL(NEO_MATCH_0) |
- SCT_EV_CTRL_STATELD(0) );
-// NEO_SCT->EV[NEO_EVENT_FALL_1].STATE = 0xFF;
- NEO_SCT->EV[NEO_EVENT_FALL_1].STATE = 0xFFFFFF;
- NEO_SCT->EV[NEO_EVENT_FALL_1].CTRL = (
- kSCTIMER_MatchEventOnly | SCT_EV_CTRL_MATCHSEL(NEO_MATCH_1) |
- SCT_EV_CTRL_STATELD(0) );
- NEO_SCT->EV[NEO_EVENT_NEXT].STATE = 0x1;
- NEO_SCT->EV[NEO_EVENT_NEXT].CTRL = (
- kSCTIMER_MatchEventOnly | SCT_EV_CTRL_MATCHSEL(NEO_MATCH_PERIOD) |
- SCT_EV_CTRL_STATELD(1) | SCT_EV_CTRL_STATEV(NEO_STATE_IDLE));
-
- NEO_SCT->LIMIT = (1 << NEO_EVENT_START) | (1 << NEO_EVENT_RISE) | (1 << NEO_EVENT_NEXT);
- NEO_SCT->HALT = (1 << NEO_EVENT_NEXT);
- NEO_SCT->START = (1 << NEO_EVENT_START);
-
- NEO_SCT->OUT[NEO_SCT_OUTPUT].SET = (1 << NEO_EVENT_START) | (1 << NEO_EVENT_RISE);
- NEO_SCT->OUT[NEO_SCT_OUTPUT].CLR = (1 << NEO_EVENT_FALL_0) | (1 << NEO_EVENT_FALL_1) | (1 << NEO_EVENT_NEXT);
-
- NEO_SCT->STATE = NEO_STATE_IDLE;
- NEO_SCT->OUTPUT = 0x0;
- NEO_SCT->RES = SCT_RES_O6RES(0x2);
- NEO_SCT->EVEN = (1 << NEO_EVENT_NEXT);
- EnableIRQ(SCT0_IRQn);
-
- neopixel_set(0, 0x101000);
- neopixel_set(1, 0x101000);
- neopixel_update();
-}
+// Global Variables
+uint32_t pixelData[NEOPIXEL_NUMBER];
/****************************************************************
name: BOARD_BootClockFROHF96M
@@ -282,7 +152,12 @@ void board_init(void)
/* PORT0 PIN27 configured as SCT0_OUT6 */
IOCON_PinMuxSet(IOCON, NEOPIXEL_PORT, NEOPIXEL_PIN, IOCON_PIO_DIG_FUNC4_EN);
- neopixel_init();
+ sctpix_init(NEOPIXEL_TYPE);
+ sctpix_addCh(NEOPIXEL_CH, pixelData, NEOPIXEL_NUMBER);
+ sctpix_setPixel(NEOPIXEL_CH, 0, 0x100010);
+ sctpix_setPixel(NEOPIXEL_CH, 1, 0x100010);
+ sctpix_show();
+
// Button
/* PORT0 PIN5 configured as PIO0_5 */
@@ -302,7 +177,7 @@ void board_init(void)
CLOCK_AttachClk(kFRO12M_to_FLEXCOMM0);
usart_config_t uart_config;
USART_GetDefaultConfig(&uart_config);
- uart_config.baudRate_Bps = BOARD_UART_BAUDRATE;
+ uart_config.baudRate_Bps = CFG_BOARD_UART_BAUDRATE;
uart_config.enableTx = true;
uart_config.enableRx = true;
USART_Init(UART_DEV, &uart_config, 12000000);
@@ -359,13 +234,13 @@ void board_led_write(bool state)
{
GPIO_PinWrite(GPIO, LED_PORT, LED_PIN, state ? LED_STATE_ON : (1-LED_STATE_ON));
if (state) {
- neopixel_set(0, 0x100000);
- neopixel_set(1, 0x101010);
+ sctpix_setPixel(NEOPIXEL_CH, 0, 0x100000);
+ sctpix_setPixel(NEOPIXEL_CH, 1, 0x101010);
} else {
- neopixel_set(0, 0x001000);
- neopixel_set(1, 0x000010);
+ sctpix_setPixel(NEOPIXEL_CH, 0, 0x001000);
+ sctpix_setPixel(NEOPIXEL_CH, 1, 0x000010);
}
- neopixel_update();
+ sctpix_show();
}
uint32_t board_button_read(void)
diff --git a/hw/bsp/feather_nrf52840_express/board.mk b/hw/bsp/feather_nrf52840_express/board.mk
index 6cc972835..059e55dff 100644
--- a/hw/bsp/feather_nrf52840_express/board.mk
+++ b/hw/bsp/feather_nrf52840_express/board.mk
@@ -14,9 +14,15 @@ CFLAGS += -Wno-error=undef -Wno-error=unused-parameter -Wno-error=cast-align
# due to tusb_hal_nrf_power_event
GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion)))
+ifeq ($(CMDEXE),1)
+ifeq ($(shell if $(GCCVERSION) geq 8 echo 1), 1)
+CFLAGS += -Wno-error=cast-function-type
+endif
+else
ifeq ($(shell expr $(GCCVERSION) \>= 8), 1)
CFLAGS += -Wno-error=cast-function-type
endif
+endif
# All source paths should be relative to the top level.
LD_FILE = hw/bsp/$(BOARD)/nrf52840_s140_v6.ld
diff --git a/hw/bsp/feather_nrf52840_sense/board.mk b/hw/bsp/feather_nrf52840_sense/board.mk
index d5f7c7cd4..3db045ac0 100644
--- a/hw/bsp/feather_nrf52840_sense/board.mk
+++ b/hw/bsp/feather_nrf52840_sense/board.mk
@@ -14,9 +14,15 @@ CFLAGS += -Wno-error=undef -Wno-error=unused-parameter -Wno-error=cast-align
# due to tusb_hal_nrf_power_event
GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion)))
+ifeq ($(CMDEXE),1)
+ifeq ($(shell if $(GCCVERSION) geq 8 echo 1), 1)
+CFLAGS += -Wno-error=cast-function-type
+endif
+else
ifeq ($(shell expr $(GCCVERSION) \>= 8), 1)
CFLAGS += -Wno-error=cast-function-type
endif
+endif
# All source paths should be relative to the top level.
LD_FILE = hw/bsp/$(BOARD)/nrf52840_s140_v6.ld
diff --git a/hw/bsp/itsybitsy_nrf52840/board.mk b/hw/bsp/itsybitsy_nrf52840/board.mk
index 6cc972835..059e55dff 100644
--- a/hw/bsp/itsybitsy_nrf52840/board.mk
+++ b/hw/bsp/itsybitsy_nrf52840/board.mk
@@ -14,9 +14,15 @@ CFLAGS += -Wno-error=undef -Wno-error=unused-parameter -Wno-error=cast-align
# due to tusb_hal_nrf_power_event
GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion)))
+ifeq ($(CMDEXE),1)
+ifeq ($(shell if $(GCCVERSION) geq 8 echo 1), 1)
+CFLAGS += -Wno-error=cast-function-type
+endif
+else
ifeq ($(shell expr $(GCCVERSION) \>= 8), 1)
CFLAGS += -Wno-error=cast-function-type
endif
+endif
# All source paths should be relative to the top level.
LD_FILE = hw/bsp/$(BOARD)/nrf52840_s140_v6.ld
diff --git a/hw/bsp/nrf52840_mdk_dongle/board.mk b/hw/bsp/nrf52840_mdk_dongle/board.mk
index 8ce8929b8..3c44e402c 100644
--- a/hw/bsp/nrf52840_mdk_dongle/board.mk
+++ b/hw/bsp/nrf52840_mdk_dongle/board.mk
@@ -13,9 +13,15 @@ CFLAGS += -Wno-error=undef -Wno-error=unused-parameter -Wno-error=cast-align
# due to tusb_hal_nrf_power_event
GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion)))
+ifeq ($(CMDEXE),1)
+ifeq ($(shell if $(GCCVERSION) geq 8 echo 1), 1)
+CFLAGS += -Wno-error=cast-function-type
+endif
+else
ifeq ($(shell expr $(GCCVERSION) \>= 8), 1)
CFLAGS += -Wno-error=cast-function-type
endif
+endif
# All source paths should be relative to the top level.
LD_FILE = hw/bsp/$(BOARD)/$(BOARD).ld
diff --git a/hw/bsp/pca10056/board.mk b/hw/bsp/pca10056/board.mk
index 8f4887dcb..b8691525b 100644
--- a/hw/bsp/pca10056/board.mk
+++ b/hw/bsp/pca10056/board.mk
@@ -14,9 +14,15 @@ CFLAGS += -Wno-error=undef -Wno-error=unused-parameter -Wno-error=cast-align
# due to tusb_hal_nrf_power_event
GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion)))
+ifeq ($(CMDEXE),1)
+ifeq ($(shell if $(GCCVERSION) geq 8 echo 1), 1)
+CFLAGS += -Wno-error=cast-function-type
+endif
+else
ifeq ($(shell expr $(GCCVERSION) \>= 8), 1)
CFLAGS += -Wno-error=cast-function-type
endif
+endif
# All source paths should be relative to the top level.
LD_FILE = hw/mcu/nordic/nrfx/mdk/nrf52840_xxaa.ld
diff --git a/hw/bsp/pca10059/board.mk b/hw/bsp/pca10059/board.mk
index bd7a80c0e..178f09474 100644
--- a/hw/bsp/pca10059/board.mk
+++ b/hw/bsp/pca10059/board.mk
@@ -14,9 +14,15 @@ CFLAGS += -Wno-error=undef -Wno-error=unused-parameter -Wno-error=cast-align
# due to tusb_hal_nrf_power_event
GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion)))
+ifeq ($(CMDEXE),1)
+ifeq ($(shell if $(GCCVERSION) geq 8 echo 1), 1)
+CFLAGS += -Wno-error=cast-function-type
+endif
+else
ifeq ($(shell expr $(GCCVERSION) \>= 8), 1)
CFLAGS += -Wno-error=cast-function-type
endif
+endif
# All source paths should be relative to the top level.
LD_FILE = hw/bsp/$(BOARD)/$(BOARD).ld
diff --git a/hw/bsp/pca10100/board.mk b/hw/bsp/pca10100/board.mk
index 4b5be082e..8ada94ba0 100644
--- a/hw/bsp/pca10100/board.mk
+++ b/hw/bsp/pca10100/board.mk
@@ -14,9 +14,15 @@ CFLAGS += -Wno-error=undef -Wno-error=unused-parameter -Wno-error=cast-align
# due to tusb_hal_nrf_power_event
GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion)))
+ifeq ($(CMDEXE),1)
+ifeq ($(shell if $(GCCVERSION) geq 8 echo 1), 1)
+CFLAGS += -Wno-error=cast-function-type
+endif
+else
ifeq ($(shell expr $(GCCVERSION) \>= 8), 1)
CFLAGS += -Wno-error=cast-function-type
endif
+endif
# All source paths should be relative to the top level.
LD_FILE = hw/mcu/nordic/nrfx/mdk/nrf52833_xxaa.ld
diff --git a/hw/bsp/raytac_mdbt50q_rx/board.mk b/hw/bsp/raytac_mdbt50q_rx/board.mk
index e153aab0b..2c29acfa6 100644
--- a/hw/bsp/raytac_mdbt50q_rx/board.mk
+++ b/hw/bsp/raytac_mdbt50q_rx/board.mk
@@ -13,9 +13,15 @@ CFLAGS += -Wno-error=undef -Wno-error=unused-parameter -Wno-error=cast-align
# due to tusb_hal_nrf_power_event
GCCVERSION = $(firstword $(subst ., ,$(shell arm-none-eabi-gcc -dumpversion)))
+ifeq ($(CMDEXE),1)
+ifeq ($(shell if $(GCCVERSION) geq 8 echo 1), 1)
+CFLAGS += -Wno-error=cast-function-type
+endif
+else
ifeq ($(shell expr $(GCCVERSION) \>= 8), 1)
CFLAGS += -Wno-error=cast-function-type
endif
+endif
# All source paths should be relative to the top level.
LD_FILE = hw/mcu/nordic/nrfx/mdk/nrf52840_xxaa.ld
diff --git a/lib/sct_neopixel b/lib/sct_neopixel
new file mode 160000
+Subproject e73e04ca63495672d955f9268e003cffe168fcd
diff --git a/tools/top.mk b/tools/top.mk
index be51b3f4f..84523a557 100644
--- a/tools/top.mk
+++ b/tools/top.mk
@@ -2,6 +2,12 @@ ifneq ($(lastword a b),b)
$(error This Makefile require make 3.81 or newer)
endif
+# Detect whether shell style is windows or not
+# https://stackoverflow.com/questions/714100/os-detecting-makefile/52062069#52062069
+ifeq '$(findstring ;,$(PATH))' ';'
+CMDEXE := 1
+endif
+
# Set TOP to be the path to get from the current directory (where make was
# invoked) to the top of the tree. $(lastword $(MAKEFILE_LIST)) returns
# the name of this makefile relative to where make was invoked.
@@ -9,9 +15,16 @@ endif
THIS_MAKEFILE := $(lastword $(MAKEFILE_LIST))
TOP := $(patsubst %/tools/top.mk,%,$(THIS_MAKEFILE))
+ifeq ($(CMDEXE),1)
+TOP := $(subst \,/,$(shell for %%i in ( $(TOP) ) do echo %%~fi))
+else
TOP := $(shell realpath $(TOP))
-
+endif
#$(info Top directory is $(TOP))
+ifeq ($(CMDEXE),1)
+CURRENT_PATH := $(subst $(TOP)/,,$(subst \,/,$(shell echo %CD%)))
+else
CURRENT_PATH := $(shell realpath --relative-to=$(TOP) `pwd`)
+endif
#$(info Path from top is $(CURRENT_PATH))