diff --git a/ext/gcc/atomics_c11_cortex.cpp.in b/ext/gcc/atomics_c11.cpp.in similarity index 99% rename from ext/gcc/atomics_c11_cortex.cpp.in rename to ext/gcc/atomics_c11.cpp.in index 63546c329f..46aef8ddb9 100644 --- a/ext/gcc/atomics_c11_cortex.cpp.in +++ b/ext/gcc/atomics_c11.cpp.in @@ -24,7 +24,7 @@ using _a8 = uint8_t; using _a16 = uint16_t; -using _a32 = unsigned int; +using _a32 = {{uint32_t}}; using _a64 = uint64_t; // =========================== atomics for >64 bits =========================== diff --git a/ext/gcc/libstdc++ b/ext/gcc/libstdc++ index 9d10e00470..300290d9ea 160000 --- a/ext/gcc/libstdc++ +++ b/ext/gcc/libstdc++ @@ -1 +1 @@ -Subproject commit 9d10e0047011f4c1e6ef4dbf76aca5e9a340a6f8 +Subproject commit 300290d9eae73795762498a7b9bc4c29c2fd1503 diff --git a/ext/gcc/module_c.lb b/ext/gcc/module_c.lb index 98f99f5065..8d47cb88e4 100644 --- a/ext/gcc/module_c.lb +++ b/ext/gcc/module_c.lb @@ -20,9 +20,9 @@ def init(module): Refines the C language to make it easier to use on embedded targets. -## ARM Cortex-M +For AVR and ARMv6-M, C11 atomics are implemented via atomic lock. -For ARMv6-M, C11 atomics are implemented via atomic lock. +## ARM Cortex-M Additional compiler options: @@ -32,10 +32,12 @@ Additional compiler options: def prepare(module, options): core = options[":target"].get_driver("core")["type"] + if core.startswith("avr") or core.startswith("cortex-m"): module.depends(":architecture:assert") - if core.startswith("cortex-m0"): - module.depends(":architecture:atomic") + + if core.startswith("avr") or core.startswith("cortex-m0"): + module.depends(":architecture:atomic") return True @@ -46,10 +48,12 @@ def build(env): env.outbasepath = "modm/ext/gcc" + if core.startswith("avr") or core.startswith("cortex-m0"): + uint32_t = "uint32_t" if core.startswith("avr") else "unsigned int" + env.template("atomics_c11.cpp.in", substitutions={"uint32_t": uint32_t}) + if core.startswith("cortex-m"): env.copy("cabi_cortex.c", "cabi.c") - if core.startswith("cortex-m0"): - env.template("atomics_c11_cortex.cpp.in") # Compiler options for targets env.collect(":build:linkflags", "--specs=nosys.specs")