[FAQ] PROCESSOR-SDK-AM64X: Undeclared Identifier for MCU GPIO Interrupt Routers

Part Number: PROCESSOR-SDK-AM64X
Other Parts Discussed in Thread: SYSCONFIG

Tool/software:

I am trying to upgrade my project to use the new MCU+ SDK 10.1 and I'm running into a compilation error saying that the interrupt router number is undeclared. This is shown below.

subdir_rules.mk:46: recipe for target 'main.o' failed
../main.c:77:22: error: use of undeclared identifier 'CSLR_MCU_M4FSS0_CORE0_INTR_MAIN_GPIOMUX_INTROUTER0_OUTP_4'
hwiPrms.intNum = USER_SWITCH_INTR_NUM;
^
C:/Users/usr /workspace_v12/gpio_led_blink_am64x-sk_m4fss0-0_nortos_ti-arm-clang/Debug/syscfg/ti_drivers_config.h:69:35: note: expanded from macro 'USER_SWITCH_INTR_NUM'
#define USER_SWITCH_INTR_NUM (CSLR_MCU_M4FSS0_CORE0_INTR_MAIN_GPIOMUX_INTROUTER0_OUTP_4)
^
1 error generated.
gmake: *** [main.o] Error 1
gmake: Target 'all' not remade because of errors.

**** Build Finished ****

Can you please help us resolving the above error?

  • The above error is coming because of the incorrect macro definition for USER_SWITCH_INTR_NUM. The template file used for code generation is not correct for MCU GPIO's.

    Please follow the below steps.

    • Please replace the template file code with the below provided code for correct file generation. The template file is located at ${MCU+SDK}/source/sysconfig/drivers/.meta/gpio/templates/gpio.h.xdt. 

     

    %%{
        let module = system.modules[args[0]];
    %%}
    /*
     * GPIO
     */
    #include <drivers/gpio.h>
    #include <kernel/dpl/AddrTranslateP.h>
    
    /* GPIO PIN Macros */
    % for(let i = 0; i < module.$instances.length; i++) {
        % let instance = module.$instances[i];
        % let config = module.getInstanceConfig(instance);
    #define `instance.$name.toUpperCase()`_BASE_ADDR (`config.baseAddr`)
    #define `instance.$name.toUpperCase()`_PIN (`config.pinIndex`)
    #define `instance.$name.toUpperCase()`_DIR (GPIO_DIRECTION_`config.pinDir`)
    #define `instance.$name.toUpperCase()`_TRIG_TYPE (GPIO_TRIG_TYPE_`config.trigType`)
    % if(config.enableIntr){
    
    %if(config.routerId === 'MCU_M4FSS0_CORE0_NVIC_MCU_MCU') {
    /* On M4F, interrupt number as specified in TRM is input to the NVIC but from M4 point of view there are 16 internal interrupts
    * and then the NVIC input interrupts start, hence we need to add +16 to the value specified by TRM */
    #define `instance.$name.toUpperCase()`_INTR_NUM      (CSLR_`config.routerId`_GPIOMUX_INTROUTER0_OUTP_`config.intrOut` + 16u)
    %}
    %else {
    #define `instance.$name.toUpperCase()`_INTR_NUM      (CSLR_`config.routerId`_GPIOMUX_INTROUTER0_OUTP_`config.intrOut`)
    %}
    
    % }
    % }
    #define CONFIG_GPIO_NUM_INSTANCES (`module.$instances.length`U)
    

    • Close the example.syscfg file if already open.
    • Open example.syscfg and remove the GPIO sections and add it again.
    • Save the file and rebuild the project.

    After making the above changes, Sysconfig tool would be able to generate files with correct macro definition.

    Regards,

    Tushar