Skip to content

Maxim: Add bare metal support to targets #14465

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 4 commits into from
Apr 15, 2021
Merged
Show file tree
Hide file tree
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
Expand Up @@ -4,8 +4,22 @@
; 256KB RAM (0x40000) @ 0x20000000


#if !defined(MBED_APP_START)
#define MBED_APP_START 0x000000000
#endif

#if !defined(MBED_APP_SIZE)
#define MBED_APP_SIZE 0x200000
#endif

; MAX32620: 2MB FLASH (0x200000) + 256KB RAM (0x40000)
#if !defined(MBED_RAM_SIZE)
#define MBED_RAM_SIZE 0x40000
#endif

#if !defined(MBED_RAM_START)
#define MBED_RAM_START 0x20000000
#endif

#if !defined(MBED_CONF_TARGET_BOOT_STACK_SIZE)
# if defined(MBED_BOOT_STACK_SIZE)
Expand All @@ -15,20 +29,26 @@
# endif
#endif

; [RAM] Vector table dynamic copy: 65 vectors * 4 bytes = 260 (0x104) + 4
; for 8 byte alignment
#define VECTOR_SIZE 0x108
#define Stack_Size MBED_CONF_TARGET_BOOT_STACK_SIZE
#define RAM_FIXED_SIZE (Stack_Size + VECTOR_SIZE)

#define MBED_RAM1_START (MBED_RAM_START+VECTOR_SIZE)
#define MBED_RAM1_SIZE (MBED_RAM_SIZE-RAM_FIXED_SIZE)

LR_IROM1 0x00000000 0x200000 { ; load region size_region
ER_IROM1 0x00000000 0x200000 { ; load address = execution address
LR_IROM1 MBED_APP_START MBED_APP_SIZE { ; load region size_region
ER_IROM1 MBED_APP_START MBED_APP_SIZE { ; load address = execution address
*.o (RESET, +First)
*(InRoot$$Sections)
.ANY (+RO)
}

; [RAM] Vector table dynamic copy: 65 vectors * 4 bytes = 260 (0x104) + 4
; for 8 byte alignment
RW_IRAM1 (0x20000000+0x108) (0x40000-0x108-Stack_Size) { ; RW data
RW_IRAM1 MBED_RAM1_START MBED_RAM1_SIZE { ; RW data
.ANY (+RW +ZI)
}
ARM_LIB_STACK (0x20000000+0x40000) EMPTY -Stack_Size { ; stack
ARM_LIB_HEAP AlignExpr(+0, +16) EMPTY (MBED_RAM_SIZE - RAM_FIXED_SIZE - (AlignExpr(ImageLimit(RW_IRAM1), 16) - MBED_RAM1_START)){ ; heap region growing up
}
ARM_LIB_STACK (MBED_RAM_START+MBED_RAM_SIZE) EMPTY -Stack_Size { ; stack region growing down
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@
#define MBED_APP_SIZE 0x00070000
#endif

#if !defined(MBED_RAM_SIZE)
#define MBED_RAM_SIZE 0x28000
#endif

#if !defined(MBED_RAM_START)
#define MBED_RAM_START 0x20000000
#endif

#if !defined(MBED_CONF_TARGET_BOOT_STACK_SIZE)
# if defined(MBED_BOOT_STACK_SIZE)
# define MBED_CONF_TARGET_BOOT_STACK_SIZE MBED_BOOT_STACK_SIZE
Expand All @@ -19,7 +27,13 @@
# endif
#endif

; [RAM] Vector table dynamic copy: 68 vectors * 4 bytes = 272 (0x110)
#define VECTOR_SIZE 0x110
#define Stack_Size MBED_CONF_TARGET_BOOT_STACK_SIZE
#define RAM_FIXED_SIZE (Stack_Size + VECTOR_SIZE)

#define MBED_RAM1_START (MBED_RAM_START+VECTOR_SIZE)
#define MBED_RAM1_SIZE (MBED_RAM_SIZE-RAM_FIXED_SIZE)

LR_IROM1 MBED_APP_START MBED_APP_SIZE { ; load region size_region
ER_IROM1 MBED_APP_START MBED_APP_SIZE { ; load address = execution address
Expand All @@ -28,10 +42,12 @@ LR_IROM1 MBED_APP_START MBED_APP_SIZE { ; load region size_region
.ANY (+RO)
}

; [RAM] Vector table dynamic copy: 68 vectors * 4 bytes = 272 (0x110)
RW_IRAM1 (0x20000000+0x110) (0x28000-0x110-Stack_Size) { ; RW data
RW_IRAM1 MBED_RAM1_START MBED_RAM1_SIZE { ; RW data
.ANY (+RW +ZI)
}
ARM_LIB_STACK (0x20000000+0x28000) EMPTY -Stack_Size { ; stack

ARM_LIB_HEAP AlignExpr(+0, +16) EMPTY (MBED_RAM_SIZE - RAM_FIXED_SIZE - (AlignExpr(ImageLimit(RW_IRAM1), 16) - MBED_RAM1_START)){ ; heap region growing up
}
ARM_LIB_STACK (MBED_RAM_START+MBED_RAM_SIZE) EMPTY -Stack_Size { ; stack region growing down
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,22 @@
; 512KB FLASH (0x80000) @ 0x000000000
; 160KB RAM (0x28000) @ 0x20000000

#if !defined(MBED_APP_START)
#define MBED_APP_START 0x000000000
#endif

#if !defined(MBED_APP_SIZE)
#define MBED_APP_SIZE 0x80000
#endif

#if !defined(MBED_RAM_SIZE)
#define MBED_RAM_SIZE 0x28000
#endif

#if !defined(MBED_RAM_START)
#define MBED_RAM_START 0x20000000
#endif

#if !defined(MBED_CONF_TARGET_BOOT_STACK_SIZE)
# if defined(MBED_BOOT_STACK_SIZE)
# define MBED_CONF_TARGET_BOOT_STACK_SIZE MBED_BOOT_STACK_SIZE
Expand All @@ -11,19 +27,27 @@
# endif
#endif

; [RAM] Vector table dynamic copy: 68 vectors * 4 bytes = 272 (0x110)
#define VECTOR_SIZE 0x110
#define Stack_Size MBED_CONF_TARGET_BOOT_STACK_SIZE
#define RAM_FIXED_SIZE (Stack_Size + VECTOR_SIZE)

LR_IROM1 0x000000000 0x80000 { ; load region size_region
ER_IROM1 0x000000000 0x80000 { ; load address = execution address
#define MBED_RAM1_START (MBED_RAM_START+VECTOR_SIZE)
#define MBED_RAM1_SIZE (MBED_RAM_SIZE-RAM_FIXED_SIZE)

LR_IROM1 MBED_APP_START MBED_APP_SIZE { ; load region size_region
ER_IROM1 MBED_APP_START MBED_APP_SIZE { ; load address = execution address
*.o (RESET, +First)
*(InRoot$$Sections)
.ANY (+RO)
}

; [RAM] Vector table dynamic copy: 68 vectors * 4 bytes = 272 (0x110)
RW_IRAM1 (0x20000000+0x110) (0x28000-0x110-Stack_Size) { ; RW data
RW_IRAM1 MBED_RAM1_START MBED_RAM1_SIZE { ; RW data
.ANY (+RW +ZI)
}
ARM_LIB_STACK (0x20000000+0x28000) EMPTY -Stack_Size { ; stack
ARM_LIB_HEAP AlignExpr(+0, +16) EMPTY (MBED_RAM_SIZE - RAM_FIXED_SIZE - (AlignExpr(ImageLimit(RW_IRAM1), 16) - MBED_RAM1_START)){ ; heap region growing up
}
ARM_LIB_STACK (MBED_RAM_START+MBED_RAM_SIZE) EMPTY -Stack_Size { ; stack region growing down
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,23 @@
; 2MB FLASH (0x200000) @ 0x000000000
; 512KB RAM (0x80000) @ 0x20000000

#if !defined(MBED_APP_START)
#define MBED_APP_START 0x000000000
#endif

#if !defined(MBED_APP_SIZE)
#define MBED_APP_SIZE 0x200000
#endif

; MAX32620: 2MB FLASH (0x200000) + 256KB RAM (0x40000)
#if !defined(MBED_RAM_SIZE)
#define MBED_RAM_SIZE 0x80000
#endif

#if !defined(MBED_RAM_START)
#define MBED_RAM_START 0x20000000
#endif

#if !defined(MBED_CONF_TARGET_BOOT_STACK_SIZE)
# if defined(MBED_BOOT_STACK_SIZE)
# define MBED_CONF_TARGET_BOOT_STACK_SIZE MBED_BOOT_STACK_SIZE
Expand All @@ -11,19 +28,27 @@
# endif
#endif

; [RAM] Vector table dynamic copy: 68 vectors * 4 bytes = 272 (0x110)
#define VECTOR_SIZE 0x110
#define Stack_Size MBED_CONF_TARGET_BOOT_STACK_SIZE
#define RAM_FIXED_SIZE (Stack_Size + VECTOR_SIZE)

LR_IROM1 0x000000000 0x200000 { ; load region size_region
ER_IROM1 0x000000000 0x200000 { ; load address = execution address
#define MBED_RAM1_START (MBED_RAM_START+VECTOR_SIZE)
#define MBED_RAM1_SIZE (MBED_RAM_SIZE-RAM_FIXED_SIZE)

LR_IROM1 MBED_APP_START MBED_APP_SIZE { ; load region size_region
ER_IROM1 MBED_APP_START MBED_APP_SIZE { ; load address = execution address
*.o (RESET, +First)
*(InRoot$$Sections)
.ANY (+RO)
}

; [RAM] Vector table dynamic copy: 68 vectors * 4 bytes = 272 (0x110)
RW_IRAM1 (0x20000000+0x110) (0x80000-0x110-Stack_Size) { ; RW data
RW_IRAM1 MBED_RAM1_START MBED_RAM1_SIZE { ; RW data
.ANY (+RW +ZI)
}
ARM_LIB_STACK (0x20000000+0x80000) EMPTY -Stack_Size { ; stack
ARM_LIB_HEAP AlignExpr(+0, +16) EMPTY (MBED_RAM_SIZE - RAM_FIXED_SIZE - (AlignExpr(ImageLimit(RW_IRAM1), 16) - MBED_RAM1_START)){ ; heap region growing up
}
ARM_LIB_STACK (MBED_RAM_START+MBED_RAM_SIZE) EMPTY -Stack_Size { ; stack region growing down
}
}
14 changes: 12 additions & 2 deletions targets/targets.json
Original file line number Diff line number Diff line change
Expand Up @@ -5184,7 +5184,6 @@
],
"supported_toolchains": [
"GCC_ARM",
"IAR",
"ARM"
],
"device_has": [
Expand All @@ -5206,7 +5205,18 @@
],
"release_versions": [
"5"
]
],
"supported_application_profiles" : ["full", "bare-metal"],
"supported_c_libs": {
"arm": [
"std",
"small"
],
"gcc_arm": [
"std",
"small"
]
}
},
"MAX32625_BASE": {
"inherits": [
Expand Down