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 <a.gatti@frob.it>
This commit is contained in:
Alessandro Gatti
2025-11-14 03:46:01 +01:00
committed by Damien George
parent 049cdd0dd3
commit 8bda61a3af

View File

@@ -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 {