From cad10ad56930074ef5024d82b5f71b588c05f5f4 Mon Sep 17 00:00:00 2001 From: Bogdan Marinescu Date: Fri, 27 Oct 2017 14:44:31 +0300 Subject: [PATCH] Add compile profiles --- features/minimal-printf/README.md | 10 ++++ features/minimal-printf/profiles/debug.json | 46 +++++++++++++++++++ features/minimal-printf/profiles/develop.json | 46 +++++++++++++++++++ features/minimal-printf/profiles/release.json | 46 +++++++++++++++++++ 4 files changed, 148 insertions(+) create mode 100644 features/minimal-printf/profiles/debug.json create mode 100644 features/minimal-printf/profiles/develop.json create mode 100644 features/minimal-printf/profiles/release.json diff --git a/features/minimal-printf/README.md b/features/minimal-printf/README.md index c6b877f1a8..107ff7591f 100644 --- a/features/minimal-printf/README.md +++ b/features/minimal-printf/README.md @@ -18,6 +18,16 @@ Supports: * %s: string. * %p: pointer (e.g. 0x00123456). +To replace the standard implementations of the printf functions with the ones in this library: + +* Add the library to your project. +* Compile with mbed-cli using one of the custom profiles in the `profiles/` subdirectory. For + example, to compile in release mode: + +``` +$ mbed compile -t -m --profile mbed-printf/profiles/release.json +``` + ## Enabling floating point, 64 bit integers, new line conversion, and setting baud rate In mbed_app.json: diff --git a/features/minimal-printf/profiles/debug.json b/features/minimal-printf/profiles/debug.json new file mode 100644 index 0000000000..f10ec679df --- /dev/null +++ b/features/minimal-printf/profiles/debug.json @@ -0,0 +1,46 @@ +{ + "GCC_ARM": { + "common": ["-c", "-Wall", "-Wextra", + "-Wno-unused-parameter", "-Wno-missing-field-initializers", + "-fmessage-length=0", "-fno-exceptions", "-fno-builtin", + "-ffunction-sections", "-fdata-sections", "-funsigned-char", + "-MMD", "-fno-delete-null-pointer-checks", + "-fomit-frame-pointer", "-O0", "-g3"], + "asm": ["-x", "assembler-with-cpp"], + "c": ["-std=gnu99"], + "cxx": ["-std=gnu++98", "-fno-rtti", "-Wvla"], + "ld": ["-Wl,--gc-sections", "-Wl,--wrap,main", "-Wl,--wrap,_malloc_r", + "-Wl,--wrap,_free_r", "-Wl,--wrap,_realloc_r", + "-Wl,--wrap,_calloc_r", "-Wl,--wrap,exit", "-Wl,--wrap,atexit", + "-Wl,-n", "-Wl,--wrap,printf", "-Wl,--wrap,snprintf", + "-Wl,--wrap,sprintf", "-Wl,--wrap,vsnprintf", "-Wl,--wrap,vprintf"] + }, + "ARM": { + "common": ["-c", "--gnu", "-Otime", "--split_sections", + "--apcs=interwork", "--brief_diagnostics", "--restrict", + "--multibyte_chars", "-O0", "-g"], + "asm": [], + "c": ["--md", "--no_depend_system_headers", "--c99", "-D__ASSERT_MSG"], + "cxx": ["--cpp", "--no_rtti", "--no_vla"], + "ld": [] + }, + "uARM": { + "common": ["-c", "--gnu", "-Otime", "--split_sections", + "--apcs=interwork", "--brief_diagnostics", "--restrict", + "--multibyte_chars", "-O0", "-D__MICROLIB", "-g", + "--library_type=microlib", "-DMBED_RTOS_SINGLE_THREAD"], + "asm": [], + "c": ["--md", "--no_depend_system_headers", "--c99", "-D__ASSERT_MSG"], + "cxx": ["--cpp", "--no_rtti", "--no_vla"], + "ld": ["--library_type=microlib"] + }, + "IAR": { + "common": [ + "--no_wrap_diagnostics", "-e", + "--diag_suppress=Pa050,Pa084,Pa093,Pa082", "-On", "-r"], + "asm": [], + "c": ["--vla"], + "cxx": ["--guard_calls", "--no_static_destruction"], + "ld": ["--skip_dynamic_initialization", "--threaded_lib"] + } +} diff --git a/features/minimal-printf/profiles/develop.json b/features/minimal-printf/profiles/develop.json new file mode 100644 index 0000000000..f0f42bd91c --- /dev/null +++ b/features/minimal-printf/profiles/develop.json @@ -0,0 +1,46 @@ +{ + "GCC_ARM": { + "common": ["-c", "-Wall", "-Wextra", + "-Wno-unused-parameter", "-Wno-missing-field-initializers", + "-fmessage-length=0", "-fno-exceptions", "-fno-builtin", + "-ffunction-sections", "-fdata-sections", "-funsigned-char", + "-MMD", "-fno-delete-null-pointer-checks", + "-fomit-frame-pointer", "-Os"], + "asm": ["-x", "assembler-with-cpp"], + "c": ["-std=gnu99"], + "cxx": ["-std=gnu++98", "-fno-rtti", "-Wvla"], + "ld": ["-Wl,--gc-sections", "-Wl,--wrap,main", "-Wl,--wrap,_malloc_r", + "-Wl,--wrap,_free_r", "-Wl,--wrap,_realloc_r", + "-Wl,--wrap,_calloc_r", "-Wl,--wrap,exit", "-Wl,--wrap,atexit", + "-Wl,-n", "-Wl,--wrap,printf", "-Wl,--wrap,snprintf", + "-Wl,--wrap,sprintf", "-Wl,--wrap,vsnprintf", "-Wl,--wrap,vprintf"] + }, + "ARM": { + "common": ["-c", "--gnu", "-Otime", "--split_sections", + "--apcs=interwork", "--brief_diagnostics", "--restrict", + "--multibyte_chars", "-O3"], + "asm": [], + "c": ["--md", "--no_depend_system_headers", "--c99", "-D__ASSERT_MSG"], + "cxx": ["--cpp", "--no_rtti", "--no_vla"], + "ld": [] + }, + "uARM": { + "common": ["-c", "--gnu", "-Otime", "--split_sections", + "--apcs=interwork", "--brief_diagnostics", "--restrict", + "--multibyte_chars", "-O3", "-D__MICROLIB", + "--library_type=microlib", "-DMBED_RTOS_SINGLE_THREAD"], + "asm": [], + "c": ["--md", "--no_depend_system_headers", "--c99", "-D__ASSERT_MSG"], + "cxx": ["--cpp", "--no_rtti", "--no_vla"], + "ld": ["--library_type=microlib"] + }, + "IAR": { + "common": [ + "--no_wrap_diagnostics", "-e", + "--diag_suppress=Pa050,Pa084,Pa093,Pa082", "-Oh"], + "asm": [], + "c": ["--vla"], + "cxx": ["--guard_calls", "--no_static_destruction"], + "ld": ["--skip_dynamic_initialization", "--threaded_lib"] + } +} diff --git a/features/minimal-printf/profiles/release.json b/features/minimal-printf/profiles/release.json new file mode 100644 index 0000000000..90578b053c --- /dev/null +++ b/features/minimal-printf/profiles/release.json @@ -0,0 +1,46 @@ +{ + "GCC_ARM": { + "common": ["-c", "-Wall", "-Wextra", + "-Wno-unused-parameter", "-Wno-missing-field-initializers", + "-fmessage-length=0", "-fno-exceptions", "-fno-builtin", + "-ffunction-sections", "-fdata-sections", "-funsigned-char", + "-MMD", "-fno-delete-null-pointer-checks", + "-fomit-frame-pointer", "-Os", "-DNDEBUG"], + "asm": ["-x", "assembler-with-cpp"], + "c": ["-std=gnu99"], + "cxx": ["-std=gnu++98", "-fno-rtti", "-Wvla"], + "ld": ["-Wl,--gc-sections", "-Wl,--wrap,main", "-Wl,--wrap,_malloc_r", + "-Wl,--wrap,_free_r", "-Wl,--wrap,_realloc_r", + "-Wl,--wrap,_calloc_r", "-Wl,--wrap,exit", "-Wl,--wrap,atexit", + "-Wl,-n", "-Wl,--wrap,printf", "-Wl,--wrap,snprintf", + "-Wl,--wrap,sprintf", "-Wl,--wrap,vsnprintf", "-Wl,--wrap,vprintf"] + }, + "ARM": { + "common": ["-c", "--gnu", "-Ospace", "--split_sections", + "--apcs=interwork", "--brief_diagnostics", "--restrict", + "--multibyte_chars", "-O3", "-DNDEBUG"], + "asm": [], + "c": ["--md", "--no_depend_system_headers", "--c99", "-D__ASSERT_MSG"], + "cxx": ["--cpp", "--no_rtti", "--no_vla"], + "ld": [] + }, + "uARM": { + "common": ["-c", "--gnu", "-Ospace", "--split_sections", + "--apcs=interwork", "--brief_diagnostics", "--restrict", + "--multibyte_chars", "-O3", "-D__MICROLIB", + "--library_type=microlib", "-DMBED_RTOS_SINGLE_THREAD", "-DNDEBUG"], + "asm": [], + "c": ["--md", "--no_depend_system_headers", "--c99", "-D__ASSERT_MSG"], + "cxx": ["--cpp", "--no_rtti", "--no_vla"], + "ld": ["--library_type=microlib"] + }, + "IAR": { + "common": [ + "--no_wrap_diagnostics", "-e", + "--diag_suppress=Pa050,Pa084,Pa093,Pa082", "-Ohz", "-DNDEBUG"], + "asm": [], + "c": ["--vla"], + "cxx": ["--guard_calls", "--no_static_destruction"], + "ld": ["--skip_dynamic_initialization", "--threaded_lib"] + } +}