Keep local Companion control parsing in a cold function
This commit is contained in:
1 parent
be6d636c79
commit
411144f69c
3 files changed
+6
-8
No files matched your search
@@ -4078,6 +4078,7 @@ bool MyMesh::handleTxRoutingCommand(const char* command, char* reply, size_t rep
|
||||
return true;
|
||||
}
|
||||
|
||||
__attribute__((noinline, cold))
|
||||
bool MyMesh::handleLocalControlCommand(const char* command, char* reply,
|
||||
size_t reply_size) {
|
||||
if (!command || !reply || reply_size == 0) return false;
|
||||
|
||||
@@ -259,7 +259,7 @@ def compile_packed_help(build_env, node):
|
||||
return build_env.Object(node, **flags)
|
||||
|
||||
|
||||
def _compile_shared_reply_copies(build_env, node, relative_path, extra_flags=()):
|
||||
def _compile_shared_reply_copies(build_env, node, relative_path):
|
||||
source = Path(node.srcnode().get_abspath()).resolve()
|
||||
expected = Path(build_env.subst("$PROJECT_DIR/" + relative_path)).resolve()
|
||||
if source != expected:
|
||||
@@ -267,9 +267,8 @@ def _compile_shared_reply_copies(build_env, node, relative_path, extra_flags=())
|
||||
# GCC otherwise expands many constant strcpy replies into repeated stores.
|
||||
# Use the same libc function and strings, with no parser or output changes.
|
||||
flags = list(build_env.get("CCFLAGS", ()))
|
||||
for flag in ("-fno-builtin-strcpy", *extra_flags):
|
||||
if flag not in flags:
|
||||
flags.append(flag)
|
||||
if "-fno-builtin-strcpy" not in flags:
|
||||
flags.append("-fno-builtin-strcpy")
|
||||
return build_env.Object(node, CCFLAGS=flags)
|
||||
|
||||
|
||||
@@ -279,8 +278,7 @@ def compile_shared_cli_replies(build_env, node):
|
||||
|
||||
|
||||
def compile_shared_companion_replies(build_env, node):
|
||||
return _compile_shared_reply_copies(build_env, node, "examples/companion_radio/MyMesh.cpp",
|
||||
("-fno-builtin-strncpy",))
|
||||
return _compile_shared_reply_copies(build_env, node, "examples/companion_radio/MyMesh.cpp")
|
||||
|
||||
|
||||
def companion_shared_replies_policy(platform, mcu, env_name, src_filter,
|
||||
|
||||
@@ -127,8 +127,7 @@ class Nrf52FlashTrimTest(unittest.TestCase):
|
||||
companion = Node(ROOT / "examples/companion_radio/MyMesh.cpp")
|
||||
result, flags = TRIM.compile_shared_companion_replies(env, companion)
|
||||
self.assertIs(result, companion)
|
||||
self.assertEqual(flags["CCFLAGS"], ["-Os", "-flto", "-fno-builtin-strcpy",
|
||||
"-fno-builtin-strncpy"])
|
||||
self.assertEqual(flags["CCFLAGS"], ["-Os", "-flto", "-fno-builtin-strcpy"])
|
||||
self.assertEqual(env["CCFLAGS"], ["-Os", "-flto"])
|
||||
for path in ("examples/simple_repeater/MyMesh.cpp", "test/fixtures/MyMesh.cpp",
|
||||
"src/helpers/CommonCLI.cpp", "src/helpers/RadioProfileCLI.cpp"):
|
||||
|
||||
Reference in new issue
Block a user