CMakeLists.txt 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. # Generated Cmake Pico project file
  2. cmake_minimum_required(VERSION 3.13)
  3. set(CMAKE_C_STANDARD 11)
  4. set(CMAKE_CXX_STANDARD 17)
  5. set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
  6. # Initialise pico_sdk from installed location
  7. # (note this can come from environment, CMake cache etc)
  8. # == DO NOT EDIT THE FOLLOWING LINES for the Raspberry Pi Pico VS Code Extension to work ==
  9. if(WIN32)
  10. set(USERHOME $ENV{USERPROFILE})
  11. else()
  12. set(USERHOME $ENV{HOME})
  13. endif()
  14. set(sdkVersion 2.3.1)
  15. set(toolchainVersion 15_2_Rel1)
  16. set(picotoolVersion 2.3.1)
  17. set(picoVscode ${USERHOME}/.pico-sdk/cmake/pico-vscode.cmake)
  18. if (EXISTS ${picoVscode})
  19. include(${picoVscode})
  20. endif()
  21. # ====================================================================================
  22. set(PICO_BOARD pico2 CACHE STRING "Board type")
  23. # Pull in Raspberry Pi Pico SDK (must be before project)
  24. include(pico_sdk_import.cmake)
  25. project(tinykernel C CXX ASM)
  26. # Initialise the Raspberry Pi Pico SDK
  27. pico_sdk_init()
  28. # Tinykernel: minimal preemptive task scheduler (Cortex-M33 / RP2350)
  29. add_library(tinykernel_lib STATIC
  30. src/scheduler.cpp
  31. src/port/m33/port_m33.c
  32. src/port/m33/context.S
  33. )
  34. target_include_directories(tinykernel_lib PUBLIC
  35. ${CMAKE_CURRENT_LIST_DIR}/include
  36. )
  37. target_link_libraries(tinykernel_lib PUBLIC pico_stdlib)
  38. # Add executable. Default name is the project name, version 0.1
  39. add_executable(tinykernel main.cpp )
  40. pico_set_program_name(tinykernel "tinykernel")
  41. pico_set_program_version(tinykernel "0.1")
  42. # Modify the below lines to enable/disable output over UART/USB
  43. pico_enable_stdio_uart(tinykernel 1)
  44. pico_enable_stdio_usb(tinykernel 0)
  45. # Add the standard library to the build
  46. target_link_libraries(tinykernel
  47. pico_stdlib
  48. tinykernel_lib)
  49. # Add the standard include files to the build
  50. target_include_directories(tinykernel PRIVATE
  51. ${CMAKE_CURRENT_LIST_DIR}
  52. )
  53. pico_add_extra_outputs(tinykernel)