Skip to content

Commit

Permalink
hw/bsp: Update all STMF7 BSPs to use common startup
Browse files Browse the repository at this point in the history
This removes local startup code and linker scripts

Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
  • Loading branch information
kasjer committed Jun 10, 2024
1 parent dd61b09 commit 524c4a5
Show file tree
Hide file tree
Showing 24 changed files with 134 additions and 2,017 deletions.
9 changes: 1 addition & 8 deletions hw/bsp/nucleo-f746zg/bsp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,9 @@ bsp.url: https://www.st.com/en/evaluation-tools/nucleo-f746zg.html
bsp.maker: "STMicroelectronics"
bsp.arch: cortex_m7
bsp.compiler: compiler/arm-none-eabi-m7
bsp.linkerscript:
- "hw/bsp/nucleo-f746zg/nucleo-f746zg.ld"
- "@apache-mynewt-core/hw/mcu/stm/stm32f7xx/stm32f746.ld"
bsp.linkerscript.BOOT_LOADER.OVERWRITE:
- "hw/bsp/nucleo-f746zg/boot-nucleo-f746zg.ld"
- "@apache-mynewt-core/hw/mcu/stm/stm32f7xx/stm32f746.ld"
bsp.linkerscript: autogenerated
bsp.downloadscript: "hw/bsp/nucleo-f746zg/nucleo-f746zg_download.sh"
bsp.debugscript: "hw/bsp/nucleo-f746zg/nucleo-f746zg_debug.sh"
bsp.downloadscript.WINDOWS.OVERWRITE: "hw/bsp/nucleo-f746zg/nucleo-f746zg_download.cmd"
bsp.debugscript.WINDOWS.OVERWRITE: "hw/bsp/nucleo-f746zg/nucleo-f746zg_debug.cmd"

bsp.flash_map:
areas:
Expand Down
12 changes: 6 additions & 6 deletions hw/bsp/nucleo-f746zg/include/bsp/bsp.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ extern "C" {
/* More convenient section placement macros. */
#define bssnz_t sec_bss_nz_core

extern uint8_t _ram_start;
extern uint8_t _dtcmram_start;
extern uint8_t _itcmram_start;
extern uint8_t _ram2_start;
extern uint8_t _ram_start[];
extern uint8_t _dtcm_start[];
extern uint8_t _itcm_start[];
extern uint8_t _ram2_start[];

#define RAM_SIZE (240 * 1024)
#define RAM2_SIZE (16 * 1024)
#define DTCMRAM_SIZE (64 * 1024)
#define ITCMRAM_SIZE (16 * 1024)
#define DTCM_SIZE (64 * 1024)
#define ITCM_SIZE (16 * 1024)

/* LED pins */
#define LED_1 MCU_GPIO_PORTB(0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,22 @@
* under the License.
*/

/* Linker script to configure memory regions. */
MEMORY
{
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 32K
ITCM (rx) : ORIGIN = 0x00000000, LENGTH = 16K
DTCM (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
RAM (rwx) : ORIGIN = 0x20010000, LENGTH = 256K
}
/*
* Memory regions placed in DTCM
* If stack or core data or other section should be place in RAM
* <target_name>/link/include/target_config.ld.h should just do:
* #undef BSSNZ_RAM
* #undef COREBSS_RAM
* #undef COREDATA_RAM
* #undef STACK_REGION
* #undef VECTOR_RELOCATION_RAM DTCM
*/

#define BSSNZ_RAM DTCM
#define COREBSS_RAM DTCM
#define COREDATA_RAM DTCM
#define STACK_REGION DTCM
#define VECTOR_RELOCATION_RAM DTCM

#define TEXT_RAM ITCM

/* The bootloader does not contain an image header */
_imghdr_size = 0x0;
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,22 @@
* under the License.
*/

/* Linker script for STM32F746 when running the bootloader */
/* Fragment that goes to MEMORY section */
#ifndef SECTIONS_REGIONS

/* Linker script to configure memory regions. */
MEMORY
{
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 32K /* FLASHAXI_BASE */
ITCM (rx) : ORIGIN = 0x00000000, LENGTH = 16K /* RAMITCM_BASE */
DTCM (rwx) : ORIGIN = 0x20000000, LENGTH = 64K /* RAMDTCM_BASE */
RAM (rwx) : ORIGIN = 0x20010000, LENGTH = 256K /* SRAM1_BASE */
}
#ifdef STACK_REGION
DTCM (rwx) : ORIGIN = 0x20000000, LENGTH = (64K - STACK_SIZE)
STACK_RAM (rw) : ORIGIN = 0x20020000 - STACK_SIZE, LENGTH = STACK_SIZE
#else
DTCM (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
#endif
ITCM (rx) : ORIGIN = 0x00000000, LENGTH = 16K

/* The bootloader does not contain an image header */
_imghdr_size = 0x0;
#else
/* Fragment that goes into SECTIONS, can provide definition and sections if needed */
_itcm_start = ORIGIN(ITCM);
_itcm_end = ORIGIN(ITCM) + LENGTH(ITCM);
_dtcm_start = ORIGIN(DTCM);
_dtcm_end = ORIGIN(DTCM) + LENGTH(DTCM);

#endif
22 changes: 0 additions & 22 deletions hw/bsp/nucleo-f746zg/nucleo-f746zg_debug.cmd

This file was deleted.

22 changes: 0 additions & 22 deletions hw/bsp/nucleo-f746zg/nucleo-f746zg_download.cmd

This file was deleted.

2 changes: 2 additions & 0 deletions hw/bsp/nucleo-f746zg/pkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,5 @@ pkg.cflags.HARDFLOAT:
pkg.deps:
- "@apache-mynewt-core/hw/mcu/stm/stm32f7xx"
- "@apache-mynewt-core/libc"
- "@apache-mynewt-core/hw/scripts"
- "@apache-mynewt-core/boot/startup"
Loading

0 comments on commit 524c4a5

Please sign in to comment.