Procházet zdrojové kódy

fbt: building `core` with respect for debug flag (#1347)

* fbt: building `core` with respect for debug flag
* fbt: added size output for firmware elf
* Infrared: fix cli

Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
hedger před 3 roky
rodič
revize
e6f18cc322

+ 1 - 0
applications/infrared/infrared_cli.c

@@ -97,6 +97,7 @@ static bool infrared_cli_parse_message(const char* str, InfraredSignal* signal)
         return false;
         return false;
     }
     }
 
 
+    message.protocol = infrared_get_protocol_by_name(protocol_name);
     message.repeat = false;
     message.repeat = false;
     infrared_signal_set_message(signal, &message);
     infrared_signal_set_message(signal, &message);
     return infrared_signal_is_valid(signal);
     return infrared_signal_is_valid(signal);

+ 12 - 1
firmware.scons

@@ -39,7 +39,17 @@ env = ENV.Clone(
             ],
             ],
             # You can add other entries named after libraries
             # You can add other entries named after libraries
             # If they are present, they have precedence over Default
             # If they are present, they have precedence over Default
-        }
+        },
+        # for furi_check to respect build type
+        "core": {
+            "CCFLAGS": [
+                "-Os",
+            ],
+            "CPPDEFINES": [
+                "NDEBUG",
+                "FURI_DEBUG" if ENV["DEBUG"] else "FURI_NDEBUG",
+            ],
+        },
     },
     },
 )
 )
 
 
@@ -191,6 +201,7 @@ fwelf = fwenv["FW_ELF"] = fwenv.Program(
 # Make it depend on everything child builders returned
 # Make it depend on everything child builders returned
 Depends(fwelf, lib_targets)
 Depends(fwelf, lib_targets)
 AddPostAction(fwelf, fwenv["APPBUILD_DUMP"])
 AddPostAction(fwelf, fwenv["APPBUILD_DUMP"])
+AddPostAction(fwelf, Action("@$SIZECOM"))
 
 
 
 
 fwhex = fwenv["FW_HEX"] = fwenv.HEXBuilder("${FIRMWARE_BUILD_CFG}")
 fwhex = fwenv["FW_HEX"] = fwenv.HEXBuilder("${FIRMWARE_BUILD_CFG}")

+ 3 - 1
site_scons/site_tools/crosscc.py

@@ -6,6 +6,7 @@ from SCons.Tool import gnulink
 import strip
 import strip
 import gdb
 import gdb
 import objdump
 import objdump
+import size
 
 
 from SCons.Action import _subproc
 from SCons.Action import _subproc
 import subprocess
 import subprocess
@@ -36,7 +37,7 @@ def _get_tool_version(env, tool):
 
 
 
 
 def generate(env, **kw):
 def generate(env, **kw):
-    for orig_tool in (asm, gcc, gxx, ar, gnulink, strip, gdb, objdump):
+    for orig_tool in (asm, gcc, gxx, ar, gnulink, strip, gdb, objdump, size):
         orig_tool.generate(env)
         orig_tool.generate(env)
     env.SetDefault(
     env.SetDefault(
         TOOLCHAIN_PREFIX=kw.get("toolchain_prefix"),
         TOOLCHAIN_PREFIX=kw.get("toolchain_prefix"),
@@ -55,6 +56,7 @@ def generate(env, **kw):
             "GDB",
             "GDB",
             "GDBPY",
             "GDBPY",
             "OBJDUMP",
             "OBJDUMP",
+            "SIZE",
         ],
         ],
     )
     )
     # Call CC to check version
     # Call CC to check version

+ 1 - 2
site_scons/site_tools/fbt_dist.py

@@ -77,8 +77,7 @@ def generate(env):
         BUILDERS={
         BUILDERS={
             "DistBuilder": Builder(
             "DistBuilder": Builder(
                 action=Action(
                 action=Action(
-                    '${PYTHON3} ${ROOT_DIR.abspath}/scripts/sconsdist.py copy -p ${DIST_PROJECTS} -s "${DIST_SUFFIX}" ${DIST_EXTRA}',
-                    "${DISTCOMSTR}",
+                    '@${PYTHON3} ${ROOT_DIR.abspath}/scripts/sconsdist.py copy -p ${DIST_PROJECTS} -s "${DIST_SUFFIX}" ${DIST_EXTRA}',
                 ),
                 ),
             ),
             ),
             "CoproBuilder": Builder(
             "CoproBuilder": Builder(

+ 24 - 0
site_scons/site_tools/size.py

@@ -0,0 +1,24 @@
+from SCons.Builder import Builder
+from SCons.Action import Action
+
+
+def generate(env):
+    env.SetDefault(
+        SIZE="size",
+        SIZEFLAGS=[],
+        SIZECOM="$SIZE $SIZEFLAGS $TARGETS",
+    )
+    env.Append(
+        BUILDERS={
+            "ELFSize": Builder(
+                action=Action(
+                    "${SIZECOM}",
+                    "${SIZECOMSTR}",
+                ),
+            ),
+        }
+    )
+
+
+def exists(env):
+    return True