Skip to content

Commit

Permalink
Update to support building for Pico 2
Browse files Browse the repository at this point in the history
- Update CMSIS to 5.7.0
- Update FreeRTOS to downstream commit aa52f214d

Note: for an existing repository clone, you must run
git submodule update --init
and delete and regenerate your build/ directory.
  • Loading branch information
P33M committed Aug 8, 2024
1 parent 2bbe900 commit 46b9613
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 64 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
url = https://github.com/ARM-software/CMSIS_5
[submodule "freertos"]
path = freertos
url = https://github.com/FreeRTOS/FreeRTOS-Kernel
url = https://github.com/raspberrypi/FreeRTOS-Kernel
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@ cmake_minimum_required(VERSION 3.12)
include(pico_sdk_import.cmake)

set(FREERTOS_KERNEL_PATH ${CMAKE_CURRENT_LIST_DIR}/freertos)
include(FreeRTOS_Kernel_import.cmake)
include(freertos/portable/ThirdParty/GCC/RP2350_ARM_NTZ/FreeRTOS_Kernel_import.cmake)

project(debugprobe)

pico_sdk_init()

if (${PICO_SDK_VERSION_MAJOR} LESS 2)
message(SEND_ERROR "Version 2 of the Pico SDK is required to compile this project. Please update your installation at ${PICO_SDK_PATH}")
endif ()

add_executable(debugprobe
src/probe_config.c
src/led.c
Expand Down
61 changes: 0 additions & 61 deletions FreeRTOS_Kernel_import.cmake

This file was deleted.

15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,21 @@ This will build with the configuration for the Pico and call the output program

Note that if you first ran through the whole sequence to compile for the Debug Probe, then you don't need to start back at the top. You can just go back to the `cmake` step and start from there.

# Building for the Pico 2

If using an existing debugprobe clone:
- You must completely regenerate your build directory, or use a different one.
- You must also sync and update submodules as rp2350 needs a downstream FreeRTOS port for now.
- `PICO_SDK_PATH` must point to a version 2.0.0 or greater install.


```
git submodule sync
git submodule update --init
mkdir build-pico2
cd build-pico2
cmake -DDEBUG_ON_PICO=1 -DPICO_BOARD=pico2 -DPICO_PLATFORM=rp2350 ../
```

# TODO
- AutoBaud selection, as PIO is a capable frequency counter
Expand Down
2 changes: 1 addition & 1 deletion freertos
Submodule freertos updated 834 files
7 changes: 7 additions & 0 deletions src/FreeRTOSConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,13 @@
#define configSUPPORT_PICO_SYNC_INTEROP 1
#define configSUPPORT_PICO_TIME_INTEROP 1

/* RP2350 grows some features */
#define configENABLE_FPU 1
#define configENABLE_MPU 0
#define configENABLE_TRUSTZONE 0
#define configRUN_FREERTOS_SECURE_ONLY 1
#define configMAX_SYSCALL_INTERRUPT_PRIORITY 16

#include <assert.h>
/* Define to trap errors during development. */
#define configASSERT(x) assert(x)
Expand Down
4 changes: 4 additions & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@
#include <stdio.h>
#include <string.h>

#if PICO_SDK_VERSION_MAJOR >= 2
#include "bsp/board_api.h"
#else
#include "bsp/board.h"
#endif
#include "tusb.h"

#include "probe_config.h"
Expand Down

0 comments on commit 46b9613

Please sign in to comment.