cancel
Showing results for 
Search instead for 
Did you mean: 

CubeIDE CPP project and Assembly Include

Wikte
Associate

Hello,

I have problem with including assembly code into my C++ project.

Include section of main.cpp:

#include "asm_math_wk.h"

asm_math_wk.h file:

#ifndef INC_ASM_MATH_WK_H_
#define INC_ASM_MATH_WK_H_

extern void megawkurw(uint32_t test);

#endif /* INC_ASM_MATH_WK_H_ */

 

asm_math_wk.s file:

.syntax unified

.global megawkurw
.type megawkurw, %function

megawkurw:
.fnstart
movs R1, R0
bx LR
.fnend

 

When I call my assembly function:

megawkurw(999);

 

I get build error:

main.cpp: undefined reference to 'megawkurw(unsigned long)'

 

This problem occurs only in .cpp, when I include same assembly code into the .c project, everything compiles fine.

 

Best Regards

1 ACCEPTED SOLUTION

Accepted Solutions

extern "C" void megawkurw(uint32_t test); // address name mangling..

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

View solution in original post

2 REPLIES 2

extern "C" void megawkurw(uint32_t test); // address name mangling..

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

It compiles fine.

You are great, thank you!

BR,

Wikte