Skip to content

Commit

Permalink
g431: added bootloader
Browse files Browse the repository at this point in the history
targetting PA15 for ST G431 discovery ESC
  • Loading branch information
tridge committed Jul 29, 2024
1 parent 5a13d38 commit 0dd7a84
Show file tree
Hide file tree
Showing 35 changed files with 16,561 additions and 237 deletions.
7 changes: 3 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ MCU_TYPE := NONE

# MCU types that we build a bootloader for - this should be $(MCU_TYPES) in the future
# when all bootloader porting is completed
BL_MCU_TYPES := E230 F031 F051 F415 F421 G071
BL_MCU_TYPES := E230 F031 F051 F415 F421 G071 G431

# Function to include makefile for each MCU type
define INCLUDE_MCU_MAKEFILES
Expand Down Expand Up @@ -110,8 +110,8 @@ $(foreach MCU,$(MCU_TYPES),$(foreach TARGET,$(TARGETS_$(MCU)), $(eval $(call CRE
# bootloader build
BOOTLOADER_VERSION := $(shell $(FGREP) "define BOOTLOADER_VERSION" $(MAIN_INC_DIR)/version.h | $(CUT) -d" " -f3 )

# we support bootloader comms on either PB4 or PA2
BOOTLOADER_PINS = PB4 PA2
# we support bootloader comms on a list of possible pins
BOOTLOADER_PINS = PB4 PA2 PA15

SRC_BL := $(foreach dir,bootloader,$(wildcard $(dir)/*.[cs]))
LDSCRIPT_BL := bootloader/ldscript_bl.ld
Expand All @@ -132,7 +132,6 @@ $(BIN_DIR)/$(call BOOTLOADER_BASENAME_VER,$(1),$(2)).elf: LDFLAGS_BL := $$(LDFLA
$(BIN_DIR)/$(call BOOTLOADER_BASENAME_VER,$(1),$(2)).elf: $$(SRC_BL)
$$(QUIET)echo building bootloader for $(1) with pin $(2)
$$(QUIET)$$(MKDIR) -p $(OBJ)
$$(QUIET)echo BUILT $(1) pin $(2) > $$@
$$(QUIET)echo Compiling $(notdir $$@)
$$(QUIET)$$(CC) $$(CFLAGS_BL) $$(LDFLAGS_BL) -o $$(@) $$(SRC_BL) $$(SRC_$(1)_BL) -Os
$$(QUIET)$$(CP) -f $$@ $$(OBJ)$$(DSEP)debug.elf
Expand Down
3 changes: 1 addition & 2 deletions Mcu/e230/Inc/blutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
*/
#pragma once

#define GPIO_PINS_2 GPIO_PIN_2
#define GPIO_PINS_4 GPIO_PIN_4
#define GPIO_PIN(n) (1U<<(n))

#define GPIO_PULL_NONE GPIO_PUPD_NONE
#define GPIO_PULL_UP GPIO_PUPD_PULLUP
Expand Down
3 changes: 1 addition & 2 deletions Mcu/f031/Inc/blutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
*/
#pragma once

#define GPIO_PINS_2 (1U<<2)
#define GPIO_PINS_4 (1U<<4)
#define GPIO_PIN(n) (1U<<(n))

#define GPIO_PULL_NONE LL_GPIO_PULL_NO
#define GPIO_PULL_UP GPIO_PUPDR_PUPDR0_0 /*!< Select I/O pull up */
Expand Down
3 changes: 1 addition & 2 deletions Mcu/f051/Inc/blutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
*/
#pragma once

#define GPIO_PINS_2 (1U<<2)
#define GPIO_PINS_4 (1U<<4)
#define GPIO_PIN(n) (1U<<(n))

#define GPIO_PULL_NONE LL_GPIO_PULL_NO
#define GPIO_PULL_UP GPIO_PUPDR_PUPDR0_0 /*!< Select I/O pull up */
Expand Down
2 changes: 2 additions & 0 deletions Mcu/f415/Inc/blutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
*/
#pragma once

#define GPIO_PIN(n) (1U<<(n))

static inline void gpio_mode_set_input(uint32_t pin, uint32_t pull_up_down)
{
if (pin < 8) {
Expand Down
2 changes: 2 additions & 0 deletions Mcu/f421/Inc/blutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
*/
#pragma once

#define GPIO_PIN(n) (1U<<(n))

static inline void gpio_mode_set_input(uint32_t pin, uint32_t pull_up_down)
{
const uint32_t pinsq = (pin*pin);
Expand Down
3 changes: 1 addition & 2 deletions Mcu/g071/Inc/blutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
*/
#pragma once

#define GPIO_PINS_2 (1U<<2)
#define GPIO_PINS_4 (1U<<4)
#define GPIO_PIN(n) (1U<<(n))

#define GPIO_PULL_NONE LL_GPIO_PULL_NO
#define GPIO_PULL_UP LL_GPIO_PULL_UP
Expand Down
Loading

0 comments on commit 0dd7a84

Please sign in to comment.