页次: 1
我找了半天没看懂DEMO.
就是比如我
```
DWORD WINAPI taskKeyBoard(LPVOID pragma)
{
(void)pragma;
int ch;
while (1)
{
if (_kbhit())
{ //如果有按键按下,则_kbhit()函数返回真
ch = _getch(); //使用_getch()函数获取按下的键值
std::cout << ch << std::endl;
if (ch == 27)
break;
}
Sleep(10); /*Just to let the system breath*/
}
}
```
我是WIN10 SIM .想键盘按1 切换到 一个界面 按2 切换到一个界面.
就这么简单的一个键盘检测 或者std::cin>>
我试了下都没用的.
然后看 keyborad.h
看不懂他到底要干嘛.我没SDL的编程基础...
希望各位大神指点下.
RT
普通的编译的cmake很多教程返利 我的lvlg模拟器就是cmake的
但这arm-none-eabi 就不行了。老提示
···
The C compiler
"C:/Program Files/PROS/toolchain/usr/bin/arm-none-eabi-gcc.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: D:/ncrApiPlus/build/CMakeFiles/CMakeTmp
Run Build Command(s):C:/ninja/ninja.exe cmTC_0c9d9 && [1/2] Building C object CMakeFiles/cmTC_0c9d9.dir/testCCompiler.c.obj
[2/2] Linking C executable cmTC_0c9d9.exe
FAILED: cmTC_0c9d9.exe
cmd.exe /C "cd . && C:\PROGRA~1\PROS\TOOLCH~1\usr\bin\AR19DD~1.EXE CMakeFiles/cmTC_0c9d9.dir/testCCompiler.c.obj -o cmTC_0c9d9.exe -Wl,--out-implib,libcmTC_0c9d9.dll.a -Wl,--major-image-version,0,--minor-image-version,0 && cd ."
c:/progra~1/pros/toolch~1/usr/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: unrecognized option '--major-image-version'
c:/progra~1/pros/toolch~1/usr/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: use the --help option for usage information
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
CMake will not be able to correctly generate this project.
···
我的cmake配置
···
cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
if(NOT CMAKE_BUILD_TYPE)
message(STATUS "CMAKE_BUILD_TYPE not set, defaulting to DEBUG")
set(CMAKE_BUILD_TYPE DEBUG)
else()
message(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
endif()
message(STATUS "CMAKE_TOOLCHAIN_FILE: ${CMAKE_TOOLCHAIN_FILE}")
project(monolith)
cmake_minimum_required(VERSION 3.6 FATAL_ERROR)
set(TARGET_CPU "cortex-a9")
set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_SYSTEM_PROCESSOR ${TARGET_CPU})
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
set(CMAKE_C_COMPILER arm-none-eabi-gcc)
set(CMAKE_CXX_COMPILER arm-none-eabi-g++)
set(CMAKE_ASM_COMPILER arm-none-eabi-gcc)
set(CMAKE_SIZE_UTIL arm-none-eabi-size)
set(COMMON_FLAGS "-mthumb -mcpu=${TARGET_CPU} -mfpu=neon-fp16 -mfloat-abi=softfp")
set(C_CXX_FLAGS "-ffunction-sections -fdata-sections -fdiagnostics-color -funwind-tables")
set(CXX_FLAGS "-D_POSIX_THREADS -D_UNIX98_THREAD_MUTEX_ATTRIBUTES")
set(CMAKE_C_FLAGS_INIT "${COMMON_FLAGS} ${C_CXX_FLAGS}" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS_INIT "${COMMON_FLAGS} ${C_CXX_FLAGS} ${CXX_FLAGS}" CACHE STRING "" FORCE)
set(CMAKE_ASM_FLAGS_INIT "${COMMON_FLAGS} -x assembler-with-cpp" CACHE STRING "" FORCE)
set(CMAKE_EXE_LINKER_FLAGS_INIT "-Wl,--gc-sections" CACHE STRING "" FORCE)
set(CMAKE_C_FLAGS_DEBUG "-Os -g" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS_DEBUG "-Os -g" CACHE STRING "" FORCE)
set(CMAKE_C_FLAGS_RELEASE "-Os -g -DNDEBUG" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS_RELEASE "-Os -g -DNDEBUG" CACHE STRING "" FORCE)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_C_USE_RESPONSE_FILE_FOR_INCLUDES ON)
set(CMAKE_C_USE_RESPONSE_FILE_FOR_LIBRARIES ON)
set(CMAKE_C_USE_RESPONSE_FILE_FOR_OBJECTS ON)
set(CMAKE_CXX_USE_RESPONSE_FILE_FOR_INCLUDES ON)
set(CMAKE_CXX_USE_RESPONSE_FILE_FOR_LIBRARIES ON)
set(CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS ON)
set(CMAKE_NINJA_FORCE_RESPONSE_FILE ON)
file(GLOB_RECURSE SOURCES CONFIGURE_DEPENDS
./include/*.h
./include/src/*.hpp
./src/*.c
./src/*.cpp
./src/*.s
)
#生成可执行文件
add_executable(${PROJECT_NAME})
target_include_directories(${PROJECT_NAME}
PRIVATE
"./include"
)
target_sources(${PROJECT_NAME}
PRIVATE
${SOURCES}
)
set_target_properties(${PROJECT_NAME}
PROPERTIES
SUFFIX ".elf"
C_STANDARD 11
C_EXTENSIONS ON
CMAKE_C_STANDARD_REQUIRED ON
CXX_STANDARD 17
CXX_EXTENSIONS ON
CMAKE_CXX_STANDARD_REQUIRED ON
)
target_compile_options(${PROJECT_NAME}
PRIVATE
-Wall
-Wextra
-Wpedantic
-Werror
-Wstrict-prototypes
-Wmissing-prototypes
-Wduplicated-cond
-Wduplicated-branches
-Wlogical-op
-Wnull-dereference
-Wshadow
-Wconversion
-Wsign-conversion
)
target_link_libraries(${PROJECT_NAME}
PRIVATE
${PROJECT_NAME}-hal
)
target_link_options(${PROJECT_NAME}
PRIVATE
-Wl,-Map=${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.map,--cref
)
utils_target_set_linker_script(${PROJECT_NAME}
${CMAKE_CURRENT_SOURCE_DIR}/link.ld
)
utils_target_generate_hex(${PROJECT_NAME})
utils_target_generate_bin(${PROJECT_NAME})
utils_target_print_size(${PROJECT_NAME})
···
3038922 说:v3s 说:mingw 编译效率确实比同配置下linux慢十倍以上,
当你决定用mingw 工具的时候已经决定了。怎么用MSBUILD啊?
据说改改 VC 可以通过编译的, 我当时偷懒用 mingw-gcc 了.
我改了下 最后链接错误?
1>------ 已启动生成: 项目: lvgl, 配置: Debug Win32 ------
1>main.obj : error LNK2019: 无法解析的外部符号 _usleep,该符号在函数 _SDL_main 中被引用
1>D:\pc_simulator\Debug\lvgl.exe : fatal error LNK1120: 1 个无法解析的外部命令
3038922 说:晕哥 说:请教版主 很多字显示不出来是为啥?比如 能 陀螺仪 等等 要设置啥字体?
检查一下字的编码对不对.
电脑上UTF8 啊.
是我如果用BTNM这个模块去显示 陀螺仪 三个字是可以的.
我用label 这个模块 去显示 陀螺仪三个字 是空白....我也不知道为啥.
请教版主 很多字显示不出来是为啥?比如 能 陀螺仪 等等 要设置啥字体?
页次: 1