update stm32wb linker to match new startup

This commit is contained in:
hathach
2025-05-14 15:28:29 +07:00
parent fe4446090e
commit 0ebc91ec97
3 changed files with 33 additions and 19 deletions

View File

@@ -233,11 +233,13 @@ void tuh_enum_descriptor_device_cb(uint8_t daddr, tusb_desc_device_t const* desc
void tuh_mount_cb(uint8_t daddr) { void tuh_mount_cb(uint8_t daddr) {
cdc_printf("mounted device %u\r\n", daddr); cdc_printf("mounted device %u\r\n", daddr);
tud_cdc_write_flush();
is_print[daddr] = true; is_print[daddr] = true;
} }
void tuh_umount_cb(uint8_t daddr) { void tuh_umount_cb(uint8_t daddr) {
cdc_printf("unmounted device %u\r\n", daddr); cdc_printf("unmounted device %u\r\n", daddr);
tud_cdc_write_flush();
is_print[daddr] = false; is_print[daddr] = false;
} }

View File

@@ -3,21 +3,26 @@
** **
** File : stm32wb55xx_flash_cm4.ld ** File : stm32wb55xx_flash_cm4.ld
** **
** Abstract : System Workbench Minimal System calls file ** Author : STM32CubeIDE
** **
** For more information about which c-functions ** Abstract : Linker script for STM32WB55xx Device
** need which of these lowlevel functions ** 1024Kbytes FLASH
** please consult the Newlib libc-manual ** 128Kbytes RAM
** **
** Environment : System Workbench for MCU ** Set heap size, stack size and stack location according
** to application requirements.
** **
** Distribution: The file is distributed “as is,” without any warranty ** Set memory bank area and size if external memory is used.
**
** Target : STMicroelectronics STM32
**
** Distribution: The file is distributed as is without any warranty
** of any kind. ** of any kind.
** **
***************************************************************************** *****************************************************************************
** @attention ** @attention
** **
** Copyright (c) 2019 STMicroelectronics. ** Copyright (c) 2019-2022 STMicroelectronics.
** All rights reserved. ** All rights reserved.
** **
** This software is licensed under terms that can be found in the LICENSE file ** This software is licensed under terms that can be found in the LICENSE file
@@ -33,7 +38,7 @@ ENTRY(Reset_Handler)
/* Highest address of the user mode stack */ /* Highest address of the user mode stack */
_estack = 0x20030000; /* end of RAM */ _estack = 0x20030000; /* end of RAM */
/* Generate a link error if heap and stack don't fit into RAM */ /* Generate a link error if heap and stack don't fit into RAM */
_Min_Heap_Size = 0x400; /* required amount of heap */ _Min_Heap_Size = 0x400; /* required amount of heap */
_Min_Stack_Size = 0x1000; /* required amount of stack */ _Min_Stack_Size = 0x1000; /* required amount of stack */
/* Specify the memory areas */ /* Specify the memory areas */
@@ -81,14 +86,17 @@ SECTIONS
. = ALIGN(4); . = ALIGN(4);
} >FLASH } >FLASH
.ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH .ARM.extab :
{
*(.ARM.extab* .gnu.linkonce.armextab.*)
} >FLASH
.ARM : { .ARM : {
__exidx_start = .; __exidx_start = .;
*(.ARM.exidx*) *(.ARM.exidx*)
__exidx_end = .; __exidx_end = .;
} >FLASH } >FLASH
.preinit_array : .preinit_array :
{ {
PROVIDE_HIDDEN (__preinit_array_start = .); PROVIDE_HIDDEN (__preinit_array_start = .);
KEEP (*(.preinit_array*)) KEEP (*(.preinit_array*))
@@ -124,7 +132,6 @@ SECTIONS
_edata = .; /* define a global symbol at data end */ _edata = .; /* define a global symbol at data end */
} >RAM1 AT> FLASH } >RAM1 AT> FLASH
/* Uninitialized data section */ /* Uninitialized data section */
. = ALIGN(4); . = ALIGN(4);
.bss : .bss :
@@ -152,8 +159,6 @@ SECTIONS
. = ALIGN(8); . = ALIGN(8);
} >RAM1 } >RAM1
/* Remove information from the standard libraries */ /* Remove information from the standard libraries */
/DISCARD/ : /DISCARD/ :
{ {
@@ -163,7 +168,15 @@ SECTIONS
} }
.ARM.attributes 0 : { *(.ARM.attributes) } .ARM.attributes 0 : { *(.ARM.attributes) }
MAPPING_TABLE (NOLOAD) : { *(MAPPING_TABLE) } >RAM_SHARED MAPPING_TABLE (NOLOAD) : { *(MAPPING_TABLE) } >RAM_SHARED
MB_MEM1 (NOLOAD) : { *(MB_MEM1) } >RAM_SHARED MB_MEM1 (NOLOAD) : { *(MB_MEM1) } >RAM_SHARED
MB_MEM2 (NOLOAD) : { _sMB_MEM2 = . ; *(MB_MEM2) ; _eMB_MEM2 = . ; } >RAM_SHARED
/* used by the startup to initialize .MB_MEM2 data */
_siMB_MEM2 = LOADADDR(.MB_MEM2);
.MB_MEM2 :
{
_sMB_MEM2 = . ;
*(MB_MEM2) ;
_eMB_MEM2 = . ;
} >RAM_SHARED AT> FLASH
} }

View File

@@ -184,8 +184,7 @@ void HardFault_Handler(void) {
asm("bkpt 1"); asm("bkpt 1");
} }
// Required by __libc_init_array in startup code if we are compiling using // Required by __libc_init_array in startup code if we are compiling using -nostdlib/-nostartfiles.
// -nostdlib/-nostartfiles. void _init(void);
void _init(void) { void _init(void) {
} }