Skip to content

Commit

Permalink
Merge pull request #25 from omicronns/master
Browse files Browse the repository at this point in the history
Create Nucleo target without bootloader support.
  • Loading branch information
devanlai authored Mar 1, 2025
2 parents e9fdd11 + e624a56 commit bcd2d2e
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 3 deletions.
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ DAP42K6U.bin: | $(BUILD_DIR)
$(Q)$(MAKE) TARGET=DAP42K6U -C src/
$(Q)cp src/DAP42.bin $(BUILD_DIR)/$(@)

DAP103-NUCLEO.bin: | $(BUILD_DIR)
@printf " BUILD $(@)\n"
$(Q)$(MAKE) TARGET=STLINKV2-1 -C src/ clean
$(Q)$(MAKE) TARGET=STLINKV2-1 -C src/
$(Q)cp src/DAP42.bin $(BUILD_DIR)/$(@)

DAP103-NUCLEO-STBOOT.bin: | $(BUILD_DIR)
@printf " BUILD $(@)\n"
$(Q)$(MAKE) TARGET=STLINKV2-1-STBOOT -C src/ clean
Expand Down
4 changes: 2 additions & 2 deletions src/stm32f103/stlinkv2-1/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#define CDC_AVAILABLE 1
#define DEFAULT_BAUDRATE 115200

#define CONSOLE_USART USART1
#define CONSOLE_USART USART2
#define CONSOLE_TX_BUFFER_SIZE 128
#define CONSOLE_RX_BUFFER_SIZE 4096

Expand All @@ -50,7 +50,7 @@
#define CONSOLE_RX_DMA_CONTROLLER DMA1
#define CONSOLE_RX_DMA_CLOCK RCC_DMA1
#define CONSOLE_RX_DMA_CHANNEL DMA_CHANNEL6

#define BULK_AVAILABLE 1
#define HID_AVAILABLE 0
#define WINUSB_AVAILABLE 1
Expand Down
2 changes: 2 additions & 0 deletions src/stm32f103/stlinkv2-1/target.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

/* Reconfigure processor settings */
void cpu_setup(void) {
#if DFU_AVAILABLE
/* Disable any interrupts enabled by the bootloader */
int i = 0;
for (i=0; i*32 < NVIC_IRQ_COUNT; i++) {
Expand All @@ -34,6 +35,7 @@ void cpu_setup(void) {

/* Relocate the vector table */
SCB_VTOR = 0x08004000;
#endif
}

/* Set STM32 to 72 MHz. */
Expand Down
9 changes: 8 additions & 1 deletion src/targets.mk
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,17 @@ ifeq ($(TARGET),STLINKV2-DONGLE-DAPBOOT)
ARCH = STM32F1
DFU_VID_PID := 1209:db42
endif
ifeq ($(TARGET),STLINKV2-1)
TARGET_COMMON_DIR := ./stm32f103
TARGET_SPEC_DIR := ./stm32f103/stlinkv2-1
LDSCRIPT ?= ./stm32f103/stm32f103x8.ld
DEFS += -DDFU_AVAILABLE=0
ARCH = STM32F1
endif
ifeq ($(TARGET),STLINKV2-1-STBOOT)
TARGET_COMMON_DIR := ./stm32f103
TARGET_SPEC_DIR := ./stm32f103/stlinkv2-1
LDSCRIPT ?= ./stm32f103/stlinkv2-1/stm32f103x8-stlinkv2-1-boot.ld
LDSCRIPT ?= ./stm32f103/stm32f103x8-stlinkv2-1-boot.ld
DEFS += -DDFU_AVAILABLE=1
ARCH = STM32F1
endif
Expand Down

0 comments on commit bcd2d2e

Please sign in to comment.