Created
December 8, 2021 00:56
-
-
Save telent/d760d4f3e9b79feed8d5020fc21d7fef to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/platforms/f4discovery/Makefile.inc b/src/platforms/f4discovery/Makefile.inc | |
index ae6b75a..578aebb 100644 | |
--- a/src/platforms/f4discovery/Makefile.inc | |
+++ b/src/platforms/f4discovery/Makefile.inc | |
@@ -26,10 +26,11 @@ $(info Load address 0x08004000 for BMPBootloader) | |
LDFLAGS = $(LDFLAGS_BOOT) -Wl,-Ttext=0x8004000 | |
CFLAGS += -DDFU_SERIAL_LENGTH=9 | |
else | |
-LDFLAGS += $(LDFLAGS_BOOT) | |
+LDFLAGS += $(LDFLAGS_BOOT) -Wl,-Ttext=0x8000000 | |
CFLAGS += -DDFU_SERIAL_LENGTH=13 | |
endif | |
+ | |
VPATH += platforms/stm32 | |
SRC += cdcacm.c \ | |
diff --git a/src/platforms/f4discovery/platform.c b/src/platforms/f4discovery/platform.c | |
index 4233f10..71aecfe 100644 | |
--- a/src/platforms/f4discovery/platform.c | |
+++ b/src/platforms/f4discovery/platform.c | |
@@ -56,6 +56,14 @@ void platform_init(void) | |
#else | |
rcc_periph_clock_enable(RCC_GPIOD); | |
#endif | |
+ | |
+ | |
+ gpio_mode_setup(LED_PORT, GPIO_MODE_OUTPUT, | |
+ GPIO_PUPD_NONE, LED_BOOTLOADER); | |
+ gpio_set(LED_PORT, LED_BOOTLOADER); | |
+ | |
+ | |
+ | |
/* Check the USER button*/ | |
if (gpio_get(GPIOA, GPIO0) || | |
((magic[0] == BOOTMAGIC0) && (magic[1] == BOOTMAGIC1))) | |
@@ -111,6 +119,7 @@ void platform_init(void) | |
gpio_mode_setup(LED_PORT, GPIO_MODE_OUTPUT, | |
GPIO_PUPD_NONE, | |
LED_IDLE_RUN | LED_ERROR | LED_BOOTLOADER); | |
+ gpio_set(LED_PORT, LED_BOOTLOADER); | |
gpio_mode_setup(LED_PORT_UART, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, LED_UART); | |
@@ -157,4 +166,4 @@ void platform_target_set_power(bool power) | |
{ | |
gpio_set_val(PWR_BR_PORT, PWR_BR_PIN, !power); | |
} | |
-#endif | |
\ No newline at end of file | |
+#endif | |
diff --git a/src/platforms/stm32/blackpillv2.ld b/src/platforms/stm32/blackpillv2.ld | |
index 4dbc774..60a04ad 100644 | |
--- a/src/platforms/stm32/blackpillv2.ld | |
+++ b/src/platforms/stm32/blackpillv2.ld | |
@@ -20,8 +20,8 @@ | |
/* Define memory regions. */ | |
MEMORY | |
{ | |
- rom (rx) : ORIGIN = 0x08000000, LENGTH = 512K | |
- ram (rwx) : ORIGIN = 0x20000000, LENGTH = 96K | |
+ rom (rx) : ORIGIN = 0x08000000, LENGTH = 256K | |
+ ram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K | |
} | |
/* Include the common ld script from libopenstm32. */ | |
diff --git a/src/platforms/stm32/dfucore.c b/src/platforms/stm32/dfucore.c | |
index b94a114..c0e73a5 100644 | |
--- a/src/platforms/stm32/dfucore.c | |
+++ b/src/platforms/stm32/dfucore.c | |
@@ -33,7 +33,7 @@ | |
# define DFU_IFACE_STRING_OFFSET 38 | |
# define DFU_IFACE_PAGESIZE 1 | |
#elif defined(STM32F4) || defined(STM32F7) | |
-# define FLASH_BASE 0x08000000U | |
+// # define FLASH_BASE 0x08000000U | |
# define DFU_IFACE_PAGESIZE 128 | |
# define DFU_IFACE_STRING_OFFSET 54 | |
# define DFU_IFACE_STRING "@Internal Flash /0x08000000/1*016Ka,3*016Kg,1*064Kg,000*128Kg" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment