|
在 cnc.cpp 中定义函数
extern "C" void cnc_loop(void);
void cnc_loop(void)
{
Motor = 1;
printf("entry MotorXForward, Motor=%d \r\n",Motor);
MotorXForward();
}
在 C 程序中调用
void cnc_loop(void);
printf("entry cnc_loop, Motor=%d \r\n",Motor);
cnc_loop();
Makefile:
obj-y += src/main.o
obj-y += src/mymath.o
obj-y += src/cnc.o
obj-y += src/IPC_protocol.o
obj-y += src/spi_slave_driver.o
obj-y += src/motor_driver.o
//obj-y += src/other_drive.o
//obj-y += src/wheel.o
obj-y += src/assert.o
obj-y += src/hooks.o
#obj-y += src/alsa_config.o
#obj-y += src/card_default.o
subdir-ccflags-y += -I components/common/thirdparty/openamp/include
cnc.o 是 c++ 编译的
编译成功,但是 cnc_loop 函数没有执行
|
|