Function is undefined although already declared in header file (.h)

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
NgXu_978681
Level 1
Level 1

  Hi everyone,

I am using CY8CKIT-062-BLE kit, PSoC Creator 4.2 (4.2.0.641)

My idea is using CM4 core to capture GPIO interrupt (SW2 button), set a flag variable then using CM0 to do something (such LED toggling...) when this flag variable is set.

GPIO Int is handled by CM4 core, so that I MUST place "User_GPIO.c" file in CM4 folder (otherwise i got error with variable &SysInt_Switch_cfg).

In this "User_GPIO.c" I created 2 functions: User_SetVal_Pin_SW2_Int_Flag(), and User_GetVal_Pin_SW2_Int_Flag() to clear and get value of that interrupt flag, respectively. Their prototypes are also declared in "User_GPIO.h" under folder "Shared Files" .

Core CM0 processes general system events by calling function Get_Event() which calls to User_GetVal_Pin_SW2_Int_Flag() to check the Int_flag continuously.

Function Get_Event() located in "User_Event_Interface.c", and this c file already got this line #include "User_GPIO.h" .

However, i got build error with msg PSoC6_IoT.cydsn/User_Event_Interface.c:49: undefined reference to `User_GetVal_Pin_SW2_Int_Flag'

Can anyone please help me to fix this?

Error_msg.JPGbuild_filter.JPG

0 Likes
1 Solution
NoriTan
Employee
Employee
25 sign-ins 5 questions asked 10 sign-ins

Please let me summarize.

1) Two functions SetVal and GetVal are declared in the CM4 firmware.

2) The function GetVal is called from the CM0 firmware.

In this case, there is a problem that it is not possible to call a function for CM4 from CM0.

If you want to use a common storage area from CM0 and CM4, please use the Inter Processor Communication (IPC) module.  Please refer following documents.

AN215656 - PSoC 6 MCU Dual-CPU System Design

CE216795 - PSoC® 6 MCU Dual-Core Basics

https://www.cypress.com/an215656

View solution in original post

0 Likes
1 Reply
NoriTan
Employee
Employee
25 sign-ins 5 questions asked 10 sign-ins

Please let me summarize.

1) Two functions SetVal and GetVal are declared in the CM4 firmware.

2) The function GetVal is called from the CM0 firmware.

In this case, there is a problem that it is not possible to call a function for CM4 from CM0.

If you want to use a common storage area from CM0 and CM4, please use the Inter Processor Communication (IPC) module.  Please refer following documents.

AN215656 - PSoC 6 MCU Dual-CPU System Design

CE216795 - PSoC® 6 MCU Dual-Core Basics

https://www.cypress.com/an215656

0 Likes