Skip to content

Commit 4d3897f

Browse files
iabdalkaderdpgeorge
authored andcommitted
mimxrt: Enable ROM text compression.
To reduce size of firmware, by about 3k.
1 parent 3257243 commit 4d3897f

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

ports/mimxrt/Makefile

+5
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ include ../../py/mkenv.mk
4040
# Include micropython configuration board makefile
4141
include $(BOARD_DIR)/mpconfigboard.mk
4242

43+
# MicroPython feature configurations
44+
MICROPY_ROM_TEXT_COMPRESSION ?= 1
45+
4346
# File containing description of content to be frozen into firmware.
4447
FROZEN_MANIFEST ?= boards/manifest.py
4548

@@ -290,6 +293,8 @@ SRC_QSTR += $(SRC_C) $(SHARED_SRC_C) $(GEN_PINS_SRC)
290293
CFLAGS += -g # always include debug info in the ELF
291294
ifeq ($(DEBUG),1)
292295
CFLAGS += -Og
296+
# Disable text compression in debug builds
297+
MICROPY_ROM_TEXT_COMPRESSION = 0
293298
else
294299
CFLAGS += -Os -DNDEBUG
295300
endif

ports/mimxrt/machine_led.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ STATIC mp_obj_t led_obj_make_new(const mp_obj_type_t *type, size_t n_args, size_
4444

4545
// Check led id is in range
4646
if (!(1 <= led_id && led_id <= NUM_LEDS)) {
47-
mp_raise_msg_varg(&mp_type_ValueError, "LED(%d) doesn't exist", led_id);
47+
mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("LED(%d) doesn't exist"), led_id);
4848
}
4949

5050
// Return reference to static object

ports/mimxrt/machine_sdcard.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ STATIC mp_obj_t sdcard_obj_make_new(const mp_obj_type_t *type, size_t n_args, si
6767
mp_int_t sdcard_id = args[SDCARD_INIT_ARG_ID].u_int;
6868

6969
if (!(1 <= sdcard_id && sdcard_id <= MP_ARRAY_SIZE(mimxrt_sdcard_objs))) {
70-
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_ValueError, "SDCard(%d) doesn't exist", sdcard_id));
70+
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("SDCard(%d) doesn't exist"), sdcard_id));
7171
}
7272

7373
mimxrt_sdcard_obj_t *self = &mimxrt_sdcard_objs[(sdcard_id - 1)];

0 commit comments

Comments
 (0)