Skip to content

Commit 8fbf90c

Browse files
author
Marcus Chang
authored
Merge pull request ARMmbed#5 from ARMmbed/add_profiles
Add compile profiles
2 parents 4279edb + 2b8828a commit 8fbf90c

File tree

4 files changed

+148
-0
lines changed

4 files changed

+148
-0
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,16 @@ Supports:
1818
* %s: string.
1919
* %p: pointer (e.g. 0x00123456).
2020

21+
To replace the standard implementations of the printf functions with the ones in this library:
22+
23+
* Add the library to your project.
24+
* Compile with mbed-cli using one of the custom profiles in the `profiles/` subdirectory. For
25+
example, to compile in release mode:
26+
27+
```
28+
$ mbed compile -t <toolchain> -m <target> --profile mbed-printf/profiles/release.json
29+
```
30+
2131
## Enabling floating point, 64 bit integers, new line conversion, and setting baud rate
2232

2333
In mbed_app.json:

profiles/debug.json

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"GCC_ARM": {
3+
"common": ["-c", "-Wall", "-Wextra",
4+
"-Wno-unused-parameter", "-Wno-missing-field-initializers",
5+
"-fmessage-length=0", "-fno-exceptions", "-fno-builtin",
6+
"-ffunction-sections", "-fdata-sections", "-funsigned-char",
7+
"-MMD", "-fno-delete-null-pointer-checks",
8+
"-fomit-frame-pointer", "-O0", "-g3"],
9+
"asm": ["-x", "assembler-with-cpp"],
10+
"c": ["-std=gnu99"],
11+
"cxx": ["-std=gnu++98", "-fno-rtti", "-Wvla"],
12+
"ld": ["-Wl,--gc-sections", "-Wl,--wrap,main", "-Wl,--wrap,_malloc_r",
13+
"-Wl,--wrap,_free_r", "-Wl,--wrap,_realloc_r",
14+
"-Wl,--wrap,_calloc_r", "-Wl,--wrap,exit", "-Wl,--wrap,atexit",
15+
"-Wl,-n", "-Wl,--wrap,printf", "-Wl,--wrap,snprintf",
16+
"-Wl,--wrap,sprintf", "-Wl,--wrap,vsnprintf", "-Wl,--wrap,vprintf"]
17+
},
18+
"ARM": {
19+
"common": ["-c", "--gnu", "-Otime", "--split_sections",
20+
"--apcs=interwork", "--brief_diagnostics", "--restrict",
21+
"--multibyte_chars", "-O0", "-g"],
22+
"asm": [],
23+
"c": ["--md", "--no_depend_system_headers", "--c99", "-D__ASSERT_MSG"],
24+
"cxx": ["--cpp", "--no_rtti", "--no_vla"],
25+
"ld": []
26+
},
27+
"uARM": {
28+
"common": ["-c", "--gnu", "-Otime", "--split_sections",
29+
"--apcs=interwork", "--brief_diagnostics", "--restrict",
30+
"--multibyte_chars", "-O0", "-D__MICROLIB", "-g",
31+
"--library_type=microlib", "-DMBED_RTOS_SINGLE_THREAD"],
32+
"asm": [],
33+
"c": ["--md", "--no_depend_system_headers", "--c99", "-D__ASSERT_MSG"],
34+
"cxx": ["--cpp", "--no_rtti", "--no_vla"],
35+
"ld": ["--library_type=microlib"]
36+
},
37+
"IAR": {
38+
"common": [
39+
"--no_wrap_diagnostics", "-e",
40+
"--diag_suppress=Pa050,Pa084,Pa093,Pa082", "-On", "-r"],
41+
"asm": [],
42+
"c": ["--vla"],
43+
"cxx": ["--guard_calls", "--no_static_destruction"],
44+
"ld": ["--skip_dynamic_initialization", "--threaded_lib"]
45+
}
46+
}

profiles/develop.json

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"GCC_ARM": {
3+
"common": ["-c", "-Wall", "-Wextra",
4+
"-Wno-unused-parameter", "-Wno-missing-field-initializers",
5+
"-fmessage-length=0", "-fno-exceptions", "-fno-builtin",
6+
"-ffunction-sections", "-fdata-sections", "-funsigned-char",
7+
"-MMD", "-fno-delete-null-pointer-checks",
8+
"-fomit-frame-pointer", "-Os"],
9+
"asm": ["-x", "assembler-with-cpp"],
10+
"c": ["-std=gnu99"],
11+
"cxx": ["-std=gnu++98", "-fno-rtti", "-Wvla"],
12+
"ld": ["-Wl,--gc-sections", "-Wl,--wrap,main", "-Wl,--wrap,_malloc_r",
13+
"-Wl,--wrap,_free_r", "-Wl,--wrap,_realloc_r",
14+
"-Wl,--wrap,_calloc_r", "-Wl,--wrap,exit", "-Wl,--wrap,atexit",
15+
"-Wl,-n", "-Wl,--wrap,printf", "-Wl,--wrap,snprintf",
16+
"-Wl,--wrap,sprintf", "-Wl,--wrap,vsnprintf", "-Wl,--wrap,vprintf"]
17+
},
18+
"ARM": {
19+
"common": ["-c", "--gnu", "-Otime", "--split_sections",
20+
"--apcs=interwork", "--brief_diagnostics", "--restrict",
21+
"--multibyte_chars", "-O3"],
22+
"asm": [],
23+
"c": ["--md", "--no_depend_system_headers", "--c99", "-D__ASSERT_MSG"],
24+
"cxx": ["--cpp", "--no_rtti", "--no_vla"],
25+
"ld": []
26+
},
27+
"uARM": {
28+
"common": ["-c", "--gnu", "-Otime", "--split_sections",
29+
"--apcs=interwork", "--brief_diagnostics", "--restrict",
30+
"--multibyte_chars", "-O3", "-D__MICROLIB",
31+
"--library_type=microlib", "-DMBED_RTOS_SINGLE_THREAD"],
32+
"asm": [],
33+
"c": ["--md", "--no_depend_system_headers", "--c99", "-D__ASSERT_MSG"],
34+
"cxx": ["--cpp", "--no_rtti", "--no_vla"],
35+
"ld": ["--library_type=microlib"]
36+
},
37+
"IAR": {
38+
"common": [
39+
"--no_wrap_diagnostics", "-e",
40+
"--diag_suppress=Pa050,Pa084,Pa093,Pa082", "-Oh"],
41+
"asm": [],
42+
"c": ["--vla"],
43+
"cxx": ["--guard_calls", "--no_static_destruction"],
44+
"ld": ["--skip_dynamic_initialization", "--threaded_lib"]
45+
}
46+
}

profiles/release.json

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"GCC_ARM": {
3+
"common": ["-c", "-Wall", "-Wextra",
4+
"-Wno-unused-parameter", "-Wno-missing-field-initializers",
5+
"-fmessage-length=0", "-fno-exceptions", "-fno-builtin",
6+
"-ffunction-sections", "-fdata-sections", "-funsigned-char",
7+
"-MMD", "-fno-delete-null-pointer-checks",
8+
"-fomit-frame-pointer", "-Os", "-DNDEBUG"],
9+
"asm": ["-x", "assembler-with-cpp"],
10+
"c": ["-std=gnu99"],
11+
"cxx": ["-std=gnu++98", "-fno-rtti", "-Wvla"],
12+
"ld": ["-Wl,--gc-sections", "-Wl,--wrap,main", "-Wl,--wrap,_malloc_r",
13+
"-Wl,--wrap,_free_r", "-Wl,--wrap,_realloc_r",
14+
"-Wl,--wrap,_calloc_r", "-Wl,--wrap,exit", "-Wl,--wrap,atexit",
15+
"-Wl,-n", "-Wl,--wrap,printf", "-Wl,--wrap,snprintf",
16+
"-Wl,--wrap,sprintf", "-Wl,--wrap,vsnprintf", "-Wl,--wrap,vprintf"]
17+
},
18+
"ARM": {
19+
"common": ["-c", "--gnu", "-Ospace", "--split_sections",
20+
"--apcs=interwork", "--brief_diagnostics", "--restrict",
21+
"--multibyte_chars", "-O3", "-DNDEBUG"],
22+
"asm": [],
23+
"c": ["--md", "--no_depend_system_headers", "--c99", "-D__ASSERT_MSG"],
24+
"cxx": ["--cpp", "--no_rtti", "--no_vla"],
25+
"ld": []
26+
},
27+
"uARM": {
28+
"common": ["-c", "--gnu", "-Ospace", "--split_sections",
29+
"--apcs=interwork", "--brief_diagnostics", "--restrict",
30+
"--multibyte_chars", "-O3", "-D__MICROLIB",
31+
"--library_type=microlib", "-DMBED_RTOS_SINGLE_THREAD", "-DNDEBUG"],
32+
"asm": [],
33+
"c": ["--md", "--no_depend_system_headers", "--c99", "-D__ASSERT_MSG"],
34+
"cxx": ["--cpp", "--no_rtti", "--no_vla"],
35+
"ld": ["--library_type=microlib"]
36+
},
37+
"IAR": {
38+
"common": [
39+
"--no_wrap_diagnostics", "-e",
40+
"--diag_suppress=Pa050,Pa084,Pa093,Pa082", "-Ohz", "-DNDEBUG"],
41+
"asm": [],
42+
"c": ["--vla"],
43+
"cxx": ["--guard_calls", "--no_static_destruction"],
44+
"ld": ["--skip_dynamic_initialization", "--threaded_lib"]
45+
}
46+
}

0 commit comments

Comments
 (0)