This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

SK-AM64B: Interrupt number is an undeclared indentifier.

Part Number: SK-AM64B
Other Parts Discussed in Thread: SYSCONFIG,

Hello,

I am trying to configure the M4FSS0 MCU on the SK-AM64B board to be a rise and fall interrupt for a switch. I get a build issue saying that the interrupt router number is unidentified. I have attached the build error, the code, and the GPIO configurations for guidance on the issue. I am unsure how to fix this issue as I figured that sysconfig would automatically create the value stored in CSLR_MCU_M4FSS0_CORE0_INTR_MAIN_GPIOMUX_INTROUTER0_OUTP_4.

Build error: 


**** Build of configuration Debug for project gpio_led_blink_am64x-sk_m4fss0-0_nortos_ti-arm-clang ****

"C:\\ti\\ccs1260\\ccs\\utils\\bin\\gmake" -k -j 24 all -O

Building file: "../main.c"
Invoking: Arm Compiler
"C:/ti/ti_cgt_tiarmclang_3.2.0.LTS/bin/tiarmclang.exe" -c -mcpu=cortex-m4 -mfloat-abi=hard -mlittle-endian -mthumb -I"C:/ti/ti_cgt_tiarmclang_3.2.0.LTS/include/c" -I"C:/ti/mcu_plus_sdk_am64x_09_01_00_41/source" -DSOC_AM64X -D_DEBUG_=1 -g -Wall -Wno-gnu-variable-sized-type-not-at-end -Wno-unused-function -MMD -MP -MF"main.d_raw" -MT"main.o" -I"C:/Users/BrycenHillukka/workspace_v12/gpio_led_blink_am64x-sk_m4fss0-0_nortos_ti-arm-clang/Debug/syscfg" -o"main.o" "../main.c"
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/BrycenHillukka/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 ****

Program:


#include <drivers/gpio.h>
#include <stdlib.h>
#include "ti_drivers_config.h"
#include "ti_board_config.h"
#include "ti_drivers_open_close.h"
#include "ti_board_open_close.h"


uint32_t IN_pinValue;

HwiP_Object gGpioHwiObject;

static void GPIO_pinIsrFxn(void *args)
{
/*
* Handle pin interrupt - This is pulse interrupt. No need to clear status
*/
DebugP_log("Interrupt triggered.\r\n");
}

void gpio_pin_interrupt_init(void)
{
uint32_t gpioIN_BaseAddr = (uint32_t) AddrTranslateP_getLocalAddr(USER_SWITCH_BASE_ADDR);
uint32_t gpioIN_PinNum = USER_SWITCH_PIN;

int32_t retVal;
HwiP_Params hwiPrms;
uint32_t bankNum;

bankNum = GPIO_GET_BANK_INDEX(gpioIN_PinNum);

/* Interrupt setup */
GPIO_setDirMode(gpioIN_BaseAddr, gpioIN_PinNum, GPIO_DIRECTION_INPUT);
GPIO_setTrigType(gpioIN_BaseAddr, gpioIN_PinNum, USER_SWITCH_TRIG_TYPE);
GPIO_bankIntrEnable(gpioIN_BaseAddr, bankNum);

/* Register pin interrupt */
HwiP_Params_init(&hwiPrms);
hwiPrms.intNum = USER_SWITCH_INTR_NUM;
hwiPrms.callback = &GPIO_pinIsrFxn;
hwiPrms.args = (void *) gpioIN_PinNum;
retVal = HwiP_construct(&gGpioHwiObject, &hwiPrms);
DebugP_log("Here");
if(SystemP_SUCCESS != retVal)
{
DebugP_assert(FALSE);
}

DebugP_log("Interrupt initialized.\r\n");
}

void gpio_pin_interrupt_deinit(void)
{
uint32_t gpioIN_BaseAddr = (uint32_t) AddrTranslateP_getLocalAddr(USER_SWITCH_BASE_ADDR);
uint32_t gpioIN_PinNum = USER_SWITCH_PIN;

uint32_t bankNum;

bankNum = GPIO_GET_BANK_INDEX(gpioIN_PinNum);

/* Interrupt disable and clear any pending interrupts */
GPIO_bankIntrDisable(gpioIN_BaseAddr, bankNum);
GPIO_setTrigType(gpioIN_BaseAddr, gpioIN_PinNum, GPIO_TRIG_TYPE_NONE);
GPIO_clearIntrStatus(gpioIN_BaseAddr, gpioIN_PinNum);

/* Unregister interrupt */
HwiP_destruct(&gGpioHwiObject);

DebugP_log("Interrupt deinitialized.\r\n");
}

int main(void)
{
System_init();
Board_init();

Drivers_open();
Board_driversOpen();

gpio_pin_interrupt_init();
while(1) {}
gpio_pin_interrupt_deinit();

Board_driversClose();
Drivers_close();

Board_deinit();
System_deinit();

return 0;
}

Thanks,

Brycen

  • Hello Brycen,

    Thanks for reaching out to Texas Instruments E2E support forum.

    I have taken your inputs and working on it. Please allow some time to revert back.

    Regards,

    Tushar

  • Hello Brycen,

    Thanks for your patience.

    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/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.

    Please let me know if this solution works.

    Regards,

    Tushar

  • This solution worked. I also had to add the function call Board_gpioInit(); after Board_driversOpen(); in the gpio_pin_interrupt_init() function.

  • Hello Brycen,

    Thanks for the confirmation and adding the additional details.

    It will also help future readers.

    Regards,

    Tushar