使用Cmake v3.8,仅在生成新生成的.hex,.map和.elf文件后,才需要运行自定义命令。但是,在生成所有* .hex,*。map和* .elf文件之后,该命令并未真正运行。这是我所拥有的:
add_custom_command(
POST_BUILD
COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/performCrc32.py
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT performCrc32.out
COMMENT "Running CRC32 check..."
)
add_custom_target(
performCrc32 ALL
DEPENDS performCrc32.py
performCrc32.out
)
Run Code Online (Sandbox Code Playgroud)
我想念的是什么?
我们知道在C语言中使用函数指针在适当的场景中使用时非常有用(在运行时调用函数与编译时间,使代码更具可读性等),但是关于简单函数调用vs的文献并不多.使用函数指针.
void foo(void) {
printf("hello\n");
}
int testFcn(void) {
// simple invokation
foo();
return 0;
}
// Or, declare function pointer and assign
void (*myFunc)(void) = foo;
int testFcn(myFunc) {
// Function pointer invokation.
myFunc();
return 0;
}
Run Code Online (Sandbox Code Playgroud)
也许唯一真正的方法是分析.lst文件和.map文件?