diff --git a/release.Makefile b/release.Makefile index dbc6779..7aa6f94 100644 --- a/release.Makefile +++ b/release.Makefile @@ -35,6 +35,7 @@ all: dapboot-bluepill.bin \ dapboot-olimexstm32h103.bin \ dapboot-bluepillplusstm32.bin \ dapboot-bttskrminie3v2.bin \ + dapboot-shinelanx.bin \ dapboot-bluepill-high.bin \ dapboot-maplemini-high.bin \ dapboot-stlink-high.bin \ @@ -92,6 +93,12 @@ dapboot-bttskrminie3v2.bin: | $(BUILD_DIR) $(Q)$(MAKE) TARGET=BTTSKRMINIE3V2 -C src/ $(Q)cp src/dapboot.bin $(BUILD_DIR)/$(@) +dapboot-shinelanx.bin: | $(BUILD_DIR) + @printf " BUILD $(@)\n" + $(Q)$(MAKE) TARGET=SHINELANX -C src/ clean + $(Q)$(MAKE) TARGET=SHINELANX -C src/ + $(Q)cp src/dapboot.bin $(BUILD_DIR)/$(@) + dapboot-bluepill-high.bin: | $(BUILD_DIR) @printf " BUILD $(@)\n" $(Q)$(MAKE) TARGET=BLUEPILL_HIGH -C src/ clean diff --git a/src/stm32f103/shinelanx/config.h b/src/stm32f103/shinelanx/config.h new file mode 100644 index 0000000..e552938 --- /dev/null +++ b/src/stm32f103/shinelanx/config.h @@ -0,0 +1,48 @@ +/* + * Permission to use, copy, modify, and/or distribute this software + * for any purpose with or without fee is hereby granted, provided + * that the above copyright notice and this permission notice + * appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE + * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef CONFIG_H_INCLUDED +#define CONFIG_H_INCLUDED + +#define APP_BASE_ADDRESS (0x08000000 + BOOTLOADER_OFFSET) +#define FLASH_PAGE_SIZE 2048 +#define DFU_UPLOAD_AVAILABLE 1 +#define DFU_DOWNLOAD_AVAILABLE 1 + +#define HAVE_LED 1 +#define LED_OPEN_DRAIN 0 +#define LED_ACTIVE_HIGH 1 +#define LED_GPIO_PORT GPIOC +#define LED_GPIO_PIN GPIO7 + +#define HAVE_BUTTON 1 +#define BUTTON_ACTIVE_HIGH 0 +#define BUTTON_GPIO_PORT GPIOA +#define BUTTON_GPIO_PIN GPIO3 +#define BUTTON_USES_PULL 0 + +#define BUTTON_SAMPLE_DELAY_CYCLES 1440000 + +#define HAVE_USB_PULLUP_CONTROL 1 +#define USB_PULLUP_GPIO_PORT GPIOA +#define USB_PULLUP_GPIO_PIN GPIO8 +#define USB_PULLUP_ACTIVE_HIGH 0 +#define USB_PULLUP_OPEN_DRAIN 1 + +#define USES_GPIOA 1 +#define USES_GPIOC 1 + +#endif diff --git a/src/stm32f103/target_stm32f103.c b/src/stm32f103/target_stm32f103.c index 1965c0e..2867870 100644 --- a/src/stm32f103/target_stm32f103.c +++ b/src/stm32f103/target_stm32f103.c @@ -50,6 +50,10 @@ #define BUTTON_USES_PULL 1 #endif +#ifndef LED_ACTIVE_HIGH +#define LED_ACTIVE_HIGH 0 +#endif + #ifdef FLASH_SIZE_OVERRIDE _Static_assert((FLASH_BASE + FLASH_SIZE_OVERRIDE >= APP_BASE_ADDRESS), "Incompatible flash size"); @@ -107,7 +111,11 @@ void target_gpio_setup(void) { if (LED_OPEN_DRAIN) { gpio_set(LED_GPIO_PORT, LED_GPIO_PIN); } else { - gpio_clear(LED_GPIO_PORT, LED_GPIO_PIN); + if (LED_ACTIVE_HIGH) { + gpio_set(LED_GPIO_PORT, LED_GPIO_PIN); + } else { + gpio_clear(LED_GPIO_PORT, LED_GPIO_PIN); + } } gpio_set_mode(LED_GPIO_PORT, mode, conf, LED_GPIO_PIN); } diff --git a/src/targets.mk b/src/targets.mk index 70aab59..ae4ff43 100644 --- a/src/targets.mk +++ b/src/targets.mk @@ -139,6 +139,19 @@ ifeq ($(TARGET),BTTSKRMINIE3V2_HIGH_256) ARCH = STM32F1 DEFS += -DBOOTLOADER_HIGH endif +ifeq ($(TARGET),SHINELANX) + TARGET_COMMON_DIR := ./stm32f103 + TARGET_SPEC_DIR := ./stm32f103/shinelanx + LDSCRIPT := ./stm32f103/stm32f103x8.ld + ARCH = STM32F1 +endif +ifeq ($(TARGET),SHINELANX_HIGH_256) + TARGET_COMMON_DIR := ./stm32f103 + TARGET_SPEC_DIR := ./stm32f103/shinelanx + LDSCRIPT := ./stm32f103/stm32f103xc_high.ld + ARCH = STM32F1 + DEFS += -DBOOTLOADER_HIGH +endif ifeq ($(TARGET),STM32L1_GENERIC) TARGET_COMMON_DIR := ./stm32l1 TARGET_SPEC_DIR := ./stm32l1/generic