Skip to content

Apollo3: Fix run time error due to memory mapping #14277

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#! armclang -E --target=arm-arm-none-eabi -x c -mcpu=cortex-m4

;
; Copyright (c) 2019-2020 SparkFun Electronics
; Copyright (c) 2019-2021 SparkFun Electronics
; SPDX-License-Identifier: MIT
;
; Permission is hereby granted, free of charge, to any person obtaining a copy
Expand Down Expand Up @@ -40,7 +40,18 @@
#define MBED_RAM0_SIZE 0x100
#define MBED_RAM1_START (MBED_RAM0_START + MBED_RAM0_SIZE)
#define MBED_RAM1_SIZE (MBED_RAM_SIZE - (MBED_RAM0_SIZE))
; This section does not contain any symbols. It is only used for the linker
; to calculate the size of the stack sections and assign values to stack
; symbols later
#define STACK_DUMMY_START (MBED_RAM1_START + MBED_RAM1_SIZE)
#define STACK_DUMMY_SIZE 0x8
Comment on lines +43 to +47
Copy link
Contributor

@LDong-Arm LDong-Arm Feb 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We got the info from the GCC linker script - the ranges of the stack and the heap are both shifted down by 8 bytes:

Dummy sections exist in many GCC linker scripts but most of them do not shift any bytes. I wonder if the 8 bytes are used for something in particular on this target? Thanks in advance. @ARMmbed/team-sparkfun

#define Stack_Start (STACK_DUMMY_START - STACK_DUMMY_SIZE)
#define Stack_Size MBED_CONF_TARGET_BOOT_STACK_SIZE
; The heap dummy section is used to identify the beginning of available dynamic memory.
#define HEAP_DUMMY_SIZE 0x8
#define Heap_Start AlignExpr(+0, 16)
#define Heap_Size (MBED_RAM_SIZE - RAM_FIXED_SIZE + MBED_RAM1_START - AlignExpr(ImageLimit(RW_IRAM1), 16) - HEAP_DUMMY_SIZE)

#define RAM_FIXED_SIZE (MBED_CONF_TARGET_BOOT_STACK_SIZE+MBED_RAM0_SIZE)


Expand All @@ -56,8 +67,8 @@ LR_IROM1 MBED_APP_START MBED_APP_SIZE {
RW_IRAM1 MBED_RAM1_START MBED_RAM1_SIZE {
.ANY (+RW +ZI)
}
ARM_LIB_HEAP AlignExpr(+0, 16) EMPTY (MBED_RAM_SIZE-RAM_FIXED_SIZE+MBED_RAM1_START-AlignExpr(ImageLimit(RW_IRAM1), 16)) {
ARM_LIB_HEAP Heap_Start EMPTY Heap_Size { ; Heap region growing up
}
ARM_LIB_STACK MBED_RAM1_START+MBED_RAM1_SIZE EMPTY -Stack_Size { ; Stack region growing down
ARM_LIB_STACK Stack_Start EMPTY -Stack_Size { ; Stack region growing down
}
}