Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

"Undefined Symbol" error when compiling , nrf51822 SDK12.3.0

Hi, I encountered the following error in keil v5.12.0.0:

linking...
.\_build\nrf51422_xxac.axf: Error: L6218E: Undefined symbol nrf_drv_gpiote_in_event_enable (referred from main.o).
.\_build\nrf51422_xxac.axf: Error: L6218E: Undefined symbol nrf_drv_gpiote_in_init (referred from main.o).
.\_build\nrf51422_xxac.axf: Error: L6218E: Undefined symbol nrf_drv_gpiote_init (referred from main.o).
Not enough information to list image symbols.
Finished: 1 information, 0 warning and 3 error messages.
".\_build\nrf51422_xxac.axf" - 3 Error(s), 2 Warning(s).

I have included nrf_drv_gpiote.h

I added nrf_drv_gpiote.c

however I did not define anything relevant to use the GPIOTE, I don't know what they are, and I don't know where to find them. I know there is some config file in nrf52 sdk, but not the case with nrf51 sdk 12.

Can you make a list of possibilities regarding where I could have overlooked? For example missing marco definition etc.

  • Hi,

    You might have forgotten to enable GPIOTE in your sdk_config.h file. Make sure to define GPIOTE_ENABLED as 1. It could be that your sdk_config.h file lacks all GPIOTE relevant defines though, in that case please try to copy paste and add this:

    //==========================================================
    // <e> GPIOTE_ENABLED - nrf_drv_gpiote - GPIOTE peripheral driver
    //==========================================================
    #ifndef GPIOTE_ENABLED
    #define GPIOTE_ENABLED 1
    #endif
    #if  GPIOTE_ENABLED
    // <o> GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS - Number of lower power input pins 
    #ifndef GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS
    #define GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS 1
    #endif
    
    // <o> GPIOTE_CONFIG_IRQ_PRIORITY  - Interrupt priority
     
    
    // <i> Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice
    // <0=> 0 (highest) 
    // <1=> 1 
    // <2=> 2 
    // <3=> 3 
    
    #ifndef GPIOTE_CONFIG_IRQ_PRIORITY
    #define GPIOTE_CONFIG_IRQ_PRIORITY 3
    #endif
    
    // <e> GPIOTE_CONFIG_LOG_ENABLED - Enables logging in the module.
    //==========================================================
    #ifndef GPIOTE_CONFIG_LOG_ENABLED
    #define GPIOTE_CONFIG_LOG_ENABLED 0
    #endif
    #if  GPIOTE_CONFIG_LOG_ENABLED
    // <o> GPIOTE_CONFIG_LOG_LEVEL  - Default Severity level
     
    // <0=> Off 
    // <1=> Error 
    // <2=> Warning 
    // <3=> Info 
    // <4=> Debug 
    
    #ifndef GPIOTE_CONFIG_LOG_LEVEL
    #define GPIOTE_CONFIG_LOG_LEVEL 3
    #endif
    
    // <o> GPIOTE_CONFIG_INFO_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef GPIOTE_CONFIG_INFO_COLOR
    #define GPIOTE_CONFIG_INFO_COLOR 0
    #endif
    
    // <o> GPIOTE_CONFIG_DEBUG_COLOR  - ANSI escape code prefix.
     
    // <0=> Default 
    // <1=> Black 
    // <2=> Red 
    // <3=> Green 
    // <4=> Yellow 
    // <5=> Blue 
    // <6=> Magenta 
    // <7=> Cyan 
    // <8=> White 
    
    #ifndef GPIOTE_CONFIG_DEBUG_COLOR
    #define GPIOTE_CONFIG_DEBUG_COLOR 0
    #endif
    
    #endif //GPIOTE_CONFIG_LOG_ENABLED
    // </e>
    
    #endif //GPIOTE_ENABLED
    // </e>

  • The SDK (12.3.0) I'm using doesn't have "GPIOTE_ENABLED" whatnot at all. I'll try to see what I can fix with some copy-pasta.

    Just curious, the dedicated gpiote program compiled just ok? I didn't really do much of anything when ripping the gpiote example from it. I didn't modify anything to the "component" folder. Yet after it was extracted from it and put into the equivalent path, it fails to compile while the timer example compile just fine.

    Edit: The copy pasta of your code into the beginning of the sdk_config.h  did the trick... for now. Thanks!

  • Happy to help. Let's hope it continues to work. 

Related