mirror of
https://github.com/stnolting/neorv32.git
synced 2025-04-24 14:17:51 -04:00
[sw] capitalize MAKE_BOOTLOADER define
adjust build process for building the bootloader (simplified/optimized code)
This commit is contained in:
parent
2420ef7c22
commit
e15a819fd7
4 changed files with 8 additions and 8 deletions
|
@ -148,9 +148,9 @@ all: $(APP_ASM) $(APP_EXE) $(APP_HEX) $(APP_BIN) $(APP_COE) $(APP_MEM) $(APP
|
|||
|
||||
# Check if making bootloader
|
||||
# Use different base address and length for instruction memory/"rom" (BOOTROM instead of IMEM)
|
||||
# Also define "make_bootloader" symbol for crt0.S, add debug symbols and use link-time optimization
|
||||
target bootloader: CC_OPTS += -Wl,--defsym=make_bootloader=1 -Dmake_bootloader -g -flto
|
||||
target bl_image: CC_OPTS += -Wl,--defsym=make_bootloader=1 -Dmake_bootloader -g -flto
|
||||
# Also define "MAKE_BOOTLOADER" symbol for simplified code when building the bootloader
|
||||
target bootloader: CC_OPTS += -Wl,--defsym=MAKE_BOOTLOADER=1 -DMAKE_BOOTLOADER -g -flto
|
||||
target bl_image: CC_OPTS += -Wl,--defsym=MAKE_BOOTLOADER=1 -DMAKE_BOOTLOADER -g -flto
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
|
|
|
@ -121,7 +121,7 @@ __crt0_clear_bss_loop_end:
|
|||
// ************************************************************************************************
|
||||
// Call constructors
|
||||
// ************************************************************************************************
|
||||
#ifndef make_bootloader // constructors are not supported for bootloader
|
||||
#ifndef MAKE_BOOTLOADER // constructors are not supported for bootloader
|
||||
__crt0_call_constructors:
|
||||
la x8, __init_array_start
|
||||
la x9, __init_array_end
|
||||
|
@ -153,7 +153,7 @@ __crt0_main_exit: // main's "return" and "exit" will arrive here
|
|||
// ************************************************************************************************
|
||||
// Call destructors
|
||||
// ************************************************************************************************
|
||||
#ifndef make_bootloader // destructors are not supported for bootloader
|
||||
#ifndef MAKE_BOOTLOADER // destructors are not supported for bootloader
|
||||
__crt0_call_destructors:
|
||||
la x8, __fini_array_start
|
||||
la x9, __fini_array_end
|
||||
|
|
|
@ -48,8 +48,8 @@ __neorv32_ram_base = DEFINED(__neorv32_ram_base) ? __neorv32_ram_base : 0x800000
|
|||
/* ************************************************************************************************* */
|
||||
MEMORY
|
||||
{
|
||||
rom (rx) : ORIGIN = DEFINED(make_bootloader) ? 0xFFFFC000 : __neorv32_rom_base, LENGTH = DEFINED(make_bootloader) ? 8K : __neorv32_rom_size
|
||||
ram (rwx) : ORIGIN = __neorv32_ram_base, LENGTH = DEFINED(make_bootloader) ? 512 : __neorv32_ram_size
|
||||
rom (rx) : ORIGIN = DEFINED(MAKE_BOOTLOADER) ? 0xFFFFC000 : __neorv32_rom_base, LENGTH = DEFINED(MAKE_BOOTLOADER) ? 8K : __neorv32_rom_size
|
||||
ram (rwx) : ORIGIN = __neorv32_ram_base, LENGTH = DEFINED(MAKE_BOOTLOADER) ? 512 : __neorv32_ram_size
|
||||
xip (rx) : ORIGIN = 0xE0000000, LENGTH = 256M
|
||||
boot (rx) : ORIGIN = 0xFFFFC000, LENGTH = 8K
|
||||
io (rwx) : ORIGIN = 0xFFFFE000, LENGTH = 8K
|
||||
|
|
|
@ -63,7 +63,7 @@ void neorv32_uart_setup(neorv32_uart_t *UARTx, uint32_t baudrate, uint32_t irq_m
|
|||
|
||||
// raw clock prescaler
|
||||
uint32_t clock = NEORV32_SYSINFO->CLK; // system clock in Hz
|
||||
#ifndef make_bootloader // use div instructions
|
||||
#ifndef MAKE_BOOTLOADER // use div instructions
|
||||
baud_div = clock / (2*baudrate);
|
||||
#else // division via repeated subtraction (minimal size, only for bootloader)
|
||||
while (clock >= 2*baudrate) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue