Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # == DO NOT EDIT THE FOLLOWING LINES for the Raspberry Pi Pico VS Code Extension to work ==
- if(WIN32)
- set(USERHOME $ENV{USERPROFILE})
- else()
- set(USERHOME $ENV{HOME})
- endif()
- set(sdkVersion 2.1.1)
- set(toolchainVersion 14_2_Rel1)
- set(picotoolVersion 2.1.1)
- set(picoVscode ${USERHOME}/.pico-sdk/cmake/pico-vscode.cmake)
- if (EXISTS ${picoVscode})
- include(${picoVscode})
- endif()
- # ====================================================================================
- # ================ 1. TOOLCHAIN FILE ================
- # ***** MUST be at the absolute top! *****
- set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/arm-none-eabi-gcc.cmake)
- # ================ 2. PICO VS CODE EXTENSION SUPPORT ================
- if(WIN32)
- set(USERHOME $ENV{USERPROFILE})
- else()
- set(USERHOME $ENV{HOME})
- endif()
- set(sdkVersion 2.1.1)
- set(toolchainVersion 14_2_Rel1)
- set(picotoolVersion 2.1.1)
- set(picoVscode ${USERHOME}/.pico-sdk/cmake/pico-vscode.cmake)
- if(EXISTS ${picoVscode})
- include(${picoVscode})
- endif()
- # ================ 3. CMake MINIMUM VERSION ================
- cmake_minimum_required(VERSION 3.3)
- # ================ 4. CHECK PICO SDK ENVIRONMENT ================
- if(NOT DEFINED ENV{PICO_SDK_PATH})
- message(FATAL_ERROR "PICO_SDK_PATH environment variable is not set. Please set it to the path of your Pico SDK installation.")
- endif()
- set(PICO_SDK_IMPORT_FILE "$ENV{PICO_SDK_PATH}/external/pico_sdk_import.cmake")
- if(NOT EXISTS "${PICO_SDK_IMPORT_FILE}")
- message(FATAL_ERROR "Cannot find pico_sdk_import.cmake at: ${PICO_SDK_IMPORT_FILE}
- Please check that PICO_SDK_PATH points to a valid Pico SDK installation.
- Current PICO_SDK_PATH: $ENV{PICO_SDK_PATH}")
- endif()
- # ================ 5. IMPORT PICO SDK (BEFORE project()!) ================
- include(${PICO_SDK_IMPORT_FILE})
- # ================ 6. PROJECT DEFINITION ================
- project(astralixi-os LANGUAGES C CXX)
- # ================ 7. TARGET BOARD & STANDARDS ================
- # Raspberry Pi Pico 2W board
- set(PICO_BOARD pico2_w)
- # C11/C++17 strongly recommended for Pico SDK!
- set(CMAKE_C_STANDARD 11)
- set(CMAKE_CXX_STANDARD 17)
- # ================ 8. INITIALIZE PICO SDK ================
- pico_sdk_init()
- # ================ 9. EXECUTABLE & SOURCES ================
- add_executable(astralixi-os
- astralixi-OS.c
- drivers/display.c
- drivers/lcd.c
- drivers/keyboard.c
- drivers/sdcard.c
- drivers/audio.c
- drivers/fat32.c
- # Add any other .c files in this format
- )
- # ================ 10. LINK LIBRARIES ================
- target_link_libraries(astralixi-os
- pico_stdlib
- hardware_spi
- hardware_uart
- hardware_pwm
- hardware_i2c
- hardware_dma
- hardware_gpio
- hardware_adc
- pico_malloc
- pico_cyw43_arch
- cyw43_arch_threadsafe_background
- )
- # ================ 11. STDIO CONFIGURATION (USB only, no UART) ================
- pico_enable_stdio_usb(astralixi-os 1)
- pico_enable_stdio_uart(astralixi-os 0)
- # ================ 12. GENERATE .uf2 & OTHER OUTPUTS ================
- pico_add_extra_outputs(astralixi-os)
- # ================ 13. COMPILER WARNINGS ================
- target_compile_options(astralixi-os PRIVATE
- -Wall
- -Wextra
- -Wno-unused-parameter
- )
- # ================ 14. INCLUDE DIRECTORIES ================
- target_include_directories(astralixi-os PRIVATE
- ${CMAKE_CURRENT_LIST_DIR}
- drivers/
- )
- # ================ 15. GLOBAL CONFIG ================
- set(CMAKE_EXPORT_COMPILE_COMMANDS YES)
Advertisement
Add Comment
Please, Sign In to add comment