Skip to content

Commit 359c59f

Browse files
committed
Added IDE/pico-sdk dir to build wolfboot+blink app
1 parent 628fbe5 commit 359c59f

File tree

17 files changed

+149
-80
lines changed

17 files changed

+149
-80
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,10 @@ IDE/Renesas/e2studio/RX72N/app_RenesasRX01/src/smc_gen
231231
IDE/Renesas/e2studio/RX72N/wolfBoot/HardwareDebug
232232
IDE/Renesas/e2studio/RX72N/wolfBoot/src/smc_gen
233233

234+
# IDE pico-sdk build directories
235+
IDE/pico-sdk/rp23550/wolfboot/build
236+
IDE/pico-sdk/rp23550/test-app/build
237+
234238
# Renesas Libraries
235239
lib/r_bsp
236240
lib/r_config
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
cmake_minimum_required(VERSION 3.13)
2+
set(WOLFBOOT_PATH ../../../../)
3+
set(CMAKE_CXX_COMPILER arm-none-eabi-gcc)
4+
5+
include(${PICO_SDK_PATH}/pico_sdk_init.cmake)
6+
7+
set(PICOTOOL_FETCH_FROM_GIT_PATH ../wolfboot/build/picotool)
8+
set(BOOT_STAGE2_FILE ${CMAKE_CURRENT_LIST_DIR}/boot2_empty.S)
9+
10+
project(blink)
11+
12+
# initialize the Raspberry Pi Pico SDK
13+
pico_sdk_init()
14+
15+
16+
add_executable(blink
17+
blink.c
18+
)
19+
20+
target_link_libraries(blink pico_stdlib)
21+
22+
# create map/bin/hex/uf2 file etc.
23+
pico_add_extra_outputs(blink)
24+
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/**
2+
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
3+
*
4+
* SPDX-License-Identifier: BSD-3-Clause
5+
*/
6+
7+
#include "pico/stdlib.h"
8+
9+
// Pico W devices use a GPIO on the WIFI chip for the LED,
10+
// so when building for Pico W, CYW43_WL_GPIO_LED_PIN will be defined
11+
#ifdef CYW43_WL_GPIO_LED_PIN
12+
#include "pico/cyw43_arch.h"
13+
#endif
14+
15+
#ifndef LED_DELAY_MS
16+
#define LED_DELAY_MS 250
17+
#endif
18+
19+
// Perform initialisation
20+
int pico_led_init(void) {
21+
#if defined(PICO_DEFAULT_LED_PIN)
22+
// A device like Pico that uses a GPIO for the LED will define PICO_DEFAULT_LED_PIN
23+
// so we can use normal GPIO functionality to turn the led on and off
24+
gpio_init(PICO_DEFAULT_LED_PIN);
25+
gpio_set_dir(PICO_DEFAULT_LED_PIN, GPIO_OUT);
26+
return PICO_OK;
27+
#elif defined(CYW43_WL_GPIO_LED_PIN)
28+
// For Pico W devices we need to initialise the driver etc
29+
return cyw43_arch_init();
30+
#endif
31+
}
32+
33+
// Turn the led on or off
34+
void pico_set_led(bool led_on) {
35+
#if defined(PICO_DEFAULT_LED_PIN)
36+
// Just set the GPIO on or off
37+
gpio_put(PICO_DEFAULT_LED_PIN, led_on);
38+
#elif defined(CYW43_WL_GPIO_LED_PIN)
39+
// Ask the wifi "driver" to set the GPIO on or off
40+
cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, led_on);
41+
#endif
42+
}
43+
44+
int main() {
45+
int rc = pico_led_init();
46+
hard_assert(rc == PICO_OK);
47+
while (true) {
48+
pico_set_led(true);
49+
sleep_ms(LED_DELAY_MS);
50+
pico_set_led(false);
51+
sleep_ms(LED_DELAY_MS);
52+
}
53+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
mkdir -p build
4+
cd build
5+
cmake .. -DPICO_SDK_PATH=$PICO_SDK_PATH -DPICO_PLATFORM=rp2350
6+
cat pico_flash_region.ld | sed -e "s/0x10000000/0x10040400/g" >pico_flash_region_wolfboot.ld
7+
cp pico_flash_region_wolfboot.ld pico_flash_region.ld
8+
make clean && make
9+
../../../../../tools/keytools/sign --sha256 --ecc256 blink.bin \
10+
../../../../../wolfboot_signing_private_key.der 1
11+
12+
cd ..
13+
14+
JLinkExe -Device RP2350_M33_0 -If swd -Speed 4000 -CommanderScript flash_app.jlink
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
connect
2+
r
3+
loadfile build/blink_v1_signed.bin 0x10040000
4+
r
5+
g
6+
exit

IDE/pico-sdk/rp23550/wolfboot/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set(CMAKE_CXX_COMPILER arm-none-eabi-gcc)
44

55
include(${PICO_SDK_PATH}/pico_sdk_init.cmake)
66

7-
set(PICOTOOL_FETCH_FROM_GIT_PATH 1)
7+
set(PICOTOOL_FETCH_FROM_GIT_PATH build/picotool)
88

99
project(wolfboot)
1010

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
#cd ../../../.. && make keytools && make src/keystore.c && cd -
3+
cd ../../../.. && make include/target.h && cd -
4+
mkdir -p build
5+
cd build
6+
cmake .. -DPICO_SDK_PATH=$PICO_SDK_PATH -DPICO_PLATFORM=rp2350
7+
make clean && make
8+
cd ..
9+
JLinkExe -Device RP2350_M33_0 -If swd -Speed 4000 -CommanderScript erase.jlink
10+
JLinkExe -Device RP2350_M33_0 -If swd -Speed 4000 -CommanderScript flash_wolfboot.jlink
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash
2+
JLinkGDBServer -Device RP2350_M33_0 -If swd -Speed 4000 -port 3333
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
connect
2+
r
3+
erase
4+
r
5+
h
6+
exit
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
connect
2+
r
3+
loadfile build/wolfboot.bin 0x10000000
4+
r
5+
g
6+
exit

0 commit comments

Comments
 (0)