Skip to content

Commit 5dbff35

Browse files
authored
Merge pull request #17 from arduino/fix-lto
Fix lto
2 parents b04726c + b4efb4b commit 5dbff35

File tree

2 files changed

+59
-1
lines changed

2 files changed

+59
-1
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ The following command will setup the mbed environment and clone the needed repos
111111

112112
```
113113
mbed config root . && mbed deploy
114-
mbed compile -m PORTENTA_H7_M7 -t GCC_ARM --profile=release --profile mbed-os/tools/profiles/extensions/lto.json
114+
mbed compile -m PORTENTA_H7_M7 -t GCC_ARM --profile=release --profile custom.json
115115
```
116116
Additional flags are needed for [Lite](generate_rel.sh#L24), [Lite Connected](generate_rel.sh#L35) and [Nicla Vision](generate_rel.sh#L46) boards.
117117

custom.json

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
"GCC_ARM": {
3+
"common": ["-Wall", "-Wextra",
4+
"-Wno-unused-parameter", "-Wno-missing-field-initializers",
5+
"-fmessage-length=0", "-fno-exceptions",
6+
"-ffunction-sections", "-fdata-sections", "-funsigned-char",
7+
"-MMD", "-flto",
8+
"-fomit-frame-pointer", "-Os", "-DNDEBUG", "-g"],
9+
"asm": ["-c", "-x", "assembler-with-cpp"],
10+
"c": ["-c", "-std=gnu11"],
11+
"cxx": ["-c", "-std=gnu++14", "-fno-rtti", "-Wvla"],
12+
"ld": ["-Wl,--gc-sections", "-Wl,--wrap,main", "-Wl,--wrap,_malloc_r",
13+
"-Wl,--wrap,_free_r", "-Wl,--wrap,_realloc_r", "-Wl,--wrap,_memalign_r",
14+
"-Wl,--wrap,_calloc_r", "-Wl,--wrap,exit", "-Wl,--wrap,atexit",
15+
"-Wl,-n", "-u __wrap_printf", "-u main", "-u malloc", "-u __wrap_snprintf", "-u _malloc_r"]
16+
},
17+
"ARMC6": {
18+
"common": ["-c", "--target=arm-arm-none-eabi", "-mthumb", "-Oz",
19+
"-Wno-armcc-pragma-push-pop", "-Wno-armcc-pragma-anon-unions",
20+
"-Wno-reserved-user-defined-literal", "-Wno-deprecated-register",
21+
"-DMULADDC_CANNOT_USE_R7", "-fdata-sections",
22+
"-fno-exceptions", "-MMD", "-fshort-enums", "-fshort-wchar",
23+
"-DNDEBUG"],
24+
"asm": [],
25+
"c": ["-D__ASSERT_MSG", "-std=gnu11"],
26+
"cxx": ["-fno-rtti", "-std=gnu++14"],
27+
"ld": ["--show_full_path", "--legacyalign", "--any_contingency",
28+
"--keep=os_cb_sections"]
29+
},
30+
"ARM": {
31+
"common": ["-c", "--gnu", "-Ospace", "--split_sections",
32+
"--apcs=interwork", "--brief_diagnostics", "--restrict",
33+
"--multibyte_chars", "-O3", "-DNDEBUG"],
34+
"asm": [],
35+
"c": ["--md", "--no_depend_system_headers", "--c99", "-D__ASSERT_MSG"],
36+
"cxx": ["--cpp11", "--no_rtti", "--no_vla"],
37+
"ld": ["--show_full_path", "--any_contingency", "--keep=os_cb_sections"]
38+
},
39+
"uARM": {
40+
"common": ["-c", "--gnu", "-Ospace", "--split_sections",
41+
"--apcs=interwork", "--brief_diagnostics", "--restrict",
42+
"--multibyte_chars", "-O3", "-D__MICROLIB",
43+
"--library_type=microlib", "-DMBED_RTOS_SINGLE_THREAD", "-DNDEBUG"],
44+
"asm": [],
45+
"c": ["--md", "--no_depend_system_headers", "--c99", "-D__ASSERT_MSG"],
46+
"cxx": ["--cpp11", "--no_rtti", "--no_vla"],
47+
"ld": ["--library_type=microlib"]
48+
},
49+
"IAR": {
50+
"common": [
51+
"--no_wrap_diagnostics", "-e",
52+
"--diag_suppress=Pa050,Pa084,Pa093,Pa082,Pe540", "-Ohz", "-DNDEBUG", "--enable_restrict"],
53+
"asm": [],
54+
"c": ["--vla", "--diag_suppress=Pe546"],
55+
"cxx": ["--guard_calls", "--no_static_destruction"],
56+
"ld": ["--skip_dynamic_initialization", "--threaded_lib", "--inline"]
57+
}
58+
}

0 commit comments

Comments
 (0)