From 8bda61a3afe3f2406d80de509d5a98b2f010fad4 Mon Sep 17 00:00:00 2001 From: Alessandro Gatti Date: Fri, 14 Nov 2025 03:46:01 +0100 Subject: [PATCH] mimxrt/pin: Reduce footprint of pin structures. This commit performs a few minor changes to the structures used to store board pin information, in order to reduce the impact on the .rodata section of the firmware of instances of those structures. The data type used to store the QSTR name of alternate function pins ("machine_pin_af_obj_t") is changed from "qstr" to "qstr_short_t", that is able to store the same name string index but in half the size. Regular pin objects structure ("machine_pin_obj_t") instead has its QSTR variable holder changed from "qstr" to "qstr_short_t", and some elements of that structure have been rearranged to remove enough padding bytes inside structure elements to let the linker allocate less data for instances of that structure. Signed-off-by: Alessandro Gatti --- ports/mimxrt/pin.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ports/mimxrt/pin.h b/ports/mimxrt/pin.h index 13b313c41f..7ee2841465 100644 --- a/ports/mimxrt/pin.h +++ b/ports/mimxrt/pin.h @@ -106,7 +106,7 @@ enum { typedef struct { mp_obj_base_t base; - qstr name; // port name + qstr_short_t name; // port name uint8_t af_mode; // alternate function uint8_t input_daisy; void *instance; // pointer to peripheral instance for alternate function @@ -121,15 +121,15 @@ typedef struct { typedef struct { mp_obj_base_t base; - qstr name; // pad name GPIO_Type *gpio; // gpio instance for pin uint32_t pin; // pin number uint32_t muxRegister; uint32_t configRegister; - uint8_t af_list_len; // length of available alternate functions list - uint8_t adc_list_len; // length of available ADC options list const machine_pin_af_obj_t *af_list; // pointer to list with alternate functions const machine_pin_adc_obj_t *adc_list; // pointer to list with ADC options + qstr_short_t name; // pad name + uint8_t af_list_len; // length of available alternate functions list + uint8_t adc_list_len; // length of available ADC options list } machine_pin_obj_t; typedef struct _machine_pin_irq_obj_t {