samd/pin_af: 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 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 04:27:17 +01:00
committed by Damien George
parent 31deee9060
commit 6572ce84c9
2 changed files with 4 additions and 4 deletions

View File

@@ -11,11 +11,11 @@
#if defined(MCU_SAMD21)
#define PIN(p_name, p_eic, p_adc0, p_sercom1, p_sercom2, p_tcc1, p_tcc2) \
{{&machine_pin_type}, PIN_##p_name, MP_QSTR_##p_name, p_eic, p_adc0, p_sercom1, p_sercom2, p_tcc1, p_tcc2 }
{{&machine_pin_type}, MP_QSTR_##p_name, PIN_##p_name, p_eic, p_adc0, p_sercom1, p_sercom2, p_tcc1, p_tcc2 }
#elif defined(MCU_SAMD51)
#define PIN(p_name, p_eic, p_adc0, p_adc1, p_sercom1, p_sercom2, p_tc, p_tcc1, p_tcc2) \
{{&machine_pin_type}, PIN_##p_name, MP_QSTR_##p_name, p_eic, p_adc0, p_adc1, p_sercom1, p_sercom2, p_tc, p_tcc1, p_tcc2 }
{{&machine_pin_type}, MP_QSTR_##p_name, PIN_##p_name, p_eic, p_adc0, p_adc1, p_sercom1, p_sercom2, p_tc, p_tcc1, p_tcc2 }
#endif

View File

@@ -32,8 +32,8 @@
typedef struct _machine_pin_obj_t {
mp_obj_base_t base;
qstr_short_t name;
uint8_t pin_id;
qstr name;
uint8_t eic;
uint8_t adc0;
uint8_t sercom1;
@@ -50,8 +50,8 @@ typedef struct _machine_pin_obj_t {
typedef struct _machine_pin_obj_t {
mp_obj_base_t base;
qstr_short_t name;
uint8_t pin_id;
qstr name;
uint8_t eic;
uint8_t adc0;
uint8_t adc1;