-
윈도우 환경에서 라즈베리파이 피코 C언어 개발환경RaspberryPi 2023. 12. 26. 14:41
Baram님의 유튜브를 참고하여 나에게 맞게 기록용으로 남긴다.
https://www.youtube.com/watch?v=RYw2WSHW42Q&t=378
리눅스 환경에서는 다음을 참고하면 된다.
https://www.raspberrypi.com/documentation/microcontrollers/raspberry-pi-pico.html
설치 리스트
git
https://git-scm.com/downloads
cmake (bin 환경변수 잡을것)
https://cmake.org/download/python
https://www.python.org/downloads/windows/
Visual Studio 2019
(2019부터 Windows Build Tools가 있기 때문)
C++ 를 사용한 데스크톱 개발 체크
https://visualstudio.microsoft.com/ko/downloads/
ARM GCC (bin 환경변수 잡을것)
https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloadsDownload CMake
You can either download binaries or source code archives for the latest stable or previous release or access the current development (aka nightly) distribution through Git. This software may not be exported in violation of any U.S. export laws or regulatio
cmake.org
minggw (bin 환경변수 잡을것)
https://sourceforge.net/projects/mingw-w64/files/mingw-w64/
SDK
적당한 폴더에서 SDK와 예제 받음
mkdir pico
cd pico
git clone https://github.com/raspberrypi/pico-sdk
git clone https://github.com/raspberrypi/pico-examplesSDK업데이트
cd pico-sdk
git submodule update --init빌드
윈도우 검색창에서 Developer Command Prompt for VS 2019 실행
SDK 폴더로 이동
환경변수 등록
setx PICO_SDK_PATH "C:\pico\pico-sdk"
창 다시 실행 후
또 다른 빌드
build 삭제 후
빌드 파일 생성
cmake -S . -B build -G "MinGW Makefiles"
이후 컴파일
cmake --build build -j20
프로젝트 만들기
폴더 만들기
example에서 CMakeLists.txt와 pico_sdk_import.cmake 복사해서 붙여넣기
예제문의 하위 폴더의 CMakeLists.txt도 src폴더내로 붙여넣기
src내의 CMakeLists
add_executable(pico-user main.c ) # pull in common dependencies target_link_libraries(pico-user pico_stdlib) # create map/bin/hex/uf2 file etc. pico_add_extra_outputs(pico-user)
pico-user 내의 CMakeLists
cmake_minimum_required(VERSION 3.12) # Pull in SDK (must be before project) include(pico_sdk_import.cmake) project(pico-user C CXX ASM) set(CMAKE_C_STANDARD 11) set(CMAKE_CXX_STANDARD 17) if (PICO_SDK_VERSION_STRING VERSION_LESS "1.3.0") message(FATAL_ERROR "Raspberry Pi Pico SDK version 1.3.0 (or later) required. Your version is ${PICO_SDK_VERSION_STRING}") endif() # Initialize the SDK pico_sdk_init() # Add project add_subdirectory(src) add_compile_options(-Wall -Wno-format # int != int32_t as far as the compiler is concerned because gcc has int32_t as long int -Wno-unused-function # we have some for the docs that aren't called ) if (CMAKE_C_COMPILER_ID STREQUAL "GNU") add_compile_options(-Wno-maybe-uninitialized) endif()
이후 빌드 파일 생성
cmake -S . -B build -G "MingGW Makefiles"
이후 빌드
cmake --build build -j20
이후 파일 생성된것 집어넣기
'RaspberryPi' 카테고리의 다른 글
라즈베리파이5 DDNS 포트포워딩 80포트 접속 안될때(고정IP) (1) 2024.03.28 라즈베리파이 UART 활성화 (0) 2023.10.24 라즈베리파이 초기세팅 SSH 활성화 방법 (0) 2023.10.24 raspberry pi GPIO control C language (0) 2023.08.28 Ubuntu 시간 관련 명령 사용하기 (0) 2022.10.12