Add options for generating UF2 image for bootloader, and set up linker symbol for bootloader config
This commit is contained in:
parent
1c9ac7382d
commit
7ea4494345
17
Makefile
17
Makefile
|
@ -5,13 +5,26 @@ BMP_PORT ?= /dev/ttyBmpGdb
|
|||
|
||||
COMFLAGS=-g -Os -pedantic -Wall
|
||||
|
||||
CFLAGS=$(COMFLAGS) -std=c99 -D_POSIX_C_SOURCE=200809L
|
||||
LIBNAME = opencm3_stm32f4
|
||||
FP_FLAGS ?= -mfloat-abi=hard -mfpu=fpv4-sp-d16
|
||||
ARCH_FLAGS = -mthumb -mcpu=cortex-m4 $(FP_FLAGS)
|
||||
DEVDEFS = -DSTM32F4 -DSTM32F4CCM -DSTM32F405RG -D_ROM=1008K -D_RAM=128K -D_CCM=64K -D_CCM_OFF=0x10000000 -D_ROM_OFF=0x08004000 -D_RAM_OFF=0x20000000
|
||||
CFLAGS=$(COMFLAGS) $(DEVDEFS) -std=c99 -D_POSIX_C_SOURCE=200809L
|
||||
CXXFLAGS=$(COMFLAGS) -std=c++17
|
||||
|
||||
LDSCRIPT = linker.ld
|
||||
|
||||
OBJS = usb.o adc.o ringbuffer.o uart.o buttons.o printf.o encoder.o
|
||||
BINARY ?= main
|
||||
DEVICE=STM32F405RG
|
||||
|
||||
printf.o: CFLAGS:=$(CFLAGS) -Wno-parentheses -Wno-char-subscripts -Wno-sign-compare -Wno-implicit-fallthrough
|
||||
|
||||
include ../rules.mk
|
||||
|
||||
uf2: main.uf2
|
||||
|
||||
main.uf2: main.bin
|
||||
uf2conv.py -c -b 0x4000 -o $@ $<
|
||||
|
||||
|
||||
.PHONY: uf2
|
||||
|
|
78
linker.ld
Normal file
78
linker.ld
Normal file
|
@ -0,0 +1,78 @@
|
|||
EXTERN(vector_table)
|
||||
ENTRY(reset_handler)
|
||||
|
||||
_estack = ORIGIN(ram) + LENGTH(ram);
|
||||
_board_dfu_dbl_tap = _estack;
|
||||
|
||||
MEMORY
|
||||
{
|
||||
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 128K - 4
|
||||
rom (rx) : ORIGIN = 0x08004000, LENGTH = 1024K - 16K
|
||||
ccm (rwx) : ORIGIN = 0x10000000, LENGTH = 64K
|
||||
}
|
||||
SECTIONS
|
||||
{
|
||||
.text : {
|
||||
*(.vectors)
|
||||
*(.text*)
|
||||
. = ALIGN(4);
|
||||
*(.rodata*)
|
||||
. = ALIGN(4);
|
||||
} >rom
|
||||
.preinit_array : {
|
||||
. = ALIGN(4);
|
||||
__preinit_array_start = .;
|
||||
KEEP (*(.preinit_array))
|
||||
__preinit_array_end = .;
|
||||
} >rom
|
||||
.init_array : {
|
||||
. = ALIGN(4);
|
||||
__init_array_start = .;
|
||||
KEEP (*(SORT(.init_array.*)))
|
||||
KEEP (*(.init_array))
|
||||
__init_array_end = .;
|
||||
} >rom
|
||||
.fini_array : {
|
||||
. = ALIGN(4);
|
||||
__fini_array_start = .;
|
||||
KEEP (*(.fini_array))
|
||||
KEEP (*(SORT(.fini_array.*)))
|
||||
__fini_array_end = .;
|
||||
} >rom
|
||||
.ARM.extab : {
|
||||
*(.ARM.extab*)
|
||||
} >rom
|
||||
.ARM.exidx : {
|
||||
__exidx_start = .;
|
||||
*(.ARM.exidx*)
|
||||
__exidx_end = .;
|
||||
} >rom
|
||||
. = ALIGN(4);
|
||||
_etext = .;
|
||||
.noinit (NOLOAD) : {
|
||||
*(.noinit*)
|
||||
} >ram
|
||||
. = ALIGN(4);
|
||||
.data : {
|
||||
_data = .;
|
||||
*(.data*)
|
||||
*(.ramtext*)
|
||||
. = ALIGN(4);
|
||||
_edata = .;
|
||||
} >ram AT >rom
|
||||
_data_loadaddr = LOADADDR(.data);
|
||||
.bss : {
|
||||
*(.bss*)
|
||||
*(COMMON)
|
||||
. = ALIGN(4);
|
||||
_ebss = .;
|
||||
} >ram
|
||||
.ccm : {
|
||||
*(.ccmram*)
|
||||
. = ALIGN(4);
|
||||
} >ccm
|
||||
/DISCARD/ : { *(.eh_frame) }
|
||||
. = ALIGN(4);
|
||||
end = .;
|
||||
}
|
||||
PROVIDE(_stack = ORIGIN(ram) + LENGTH(ram));
|
Loading…
Reference in New Issue
Block a user