Skip to content

Commit cc0e90e

Browse files
giulcioffifacchinm
authored andcommitted
Port pico-sdk 1.3.0 - initial
1 parent 9e7e8c7 commit cc0e90e

File tree

290 files changed

+57310
-24766
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

290 files changed

+57310
-24766
lines changed

targets/TARGET_RASPBERRYPI/TARGET_RP2040/pico-sdk/CMakeLists.txt

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,37 +11,54 @@ if (NOT EXISTS "${PICO_PLATFORM_CMAKE_FILE}")
1111
Either specify a valid PICO_PLATFORM (or PICO_PLATFORM_CMAKE_FILE).")
1212
endif ()
1313

14+
# Initialize board related build/compile settings
1415
include(${CMAKE_CURRENT_LIST_DIR}/board_setup.cmake)
1516

16-
# todo add option to disable skip flag
17+
# call add_subdirectory(subdir) unless SKIP_SUBDIR evaluates to true
1718
function(pico_add_subdirectory subdir)
19+
# todo add option to disable skip flag
1820
string(TOUPPER ${subdir} subdir_upper)
1921
set(replace_flag SKIP_${subdir_upper})
2022
if (NOT ${replace_flag})
2123
add_subdirectory(${subdir})
2224
else ()
2325
message("Not including ${subdir} because ${replace_flag} defined.")
2426
endif ()
27+
pico_promote_common_scope_vars()
2528
endfunction()
2629

30+
# add a link option to wrap the given function name; i.e. -Wl:wrap=FUNCNAME for gcc
2731
function(pico_wrap_function TARGET FUNCNAME)
2832
target_link_options(${TARGET} INTERFACE "LINKER:--wrap=${FUNCNAME}")
2933
endfunction()
3034

35+
# add map file generation for the given target
3136
function(pico_add_map_output TARGET)
3237
get_target_property(target_type ${TARGET} TYPE)
3338
if ("EXECUTABLE" STREQUAL "${target_type}")
34-
target_link_options(${TARGET} PRIVATE "LINKER:-Map=$<TARGET_PROPERTY:NAME>${CMAKE_EXECUTABLE_SUFFIX}.map")
39+
target_link_options(${TARGET} PRIVATE "LINKER:-Map=$<IF:$<BOOL:$<TARGET_PROPERTY:OUTPUT_NAME>>,$<TARGET_PROPERTY:OUTPUT_NAME>,$<TARGET_PROPERTY:NAME>>${CMAKE_EXECUTABLE_SUFFIX}.map")
3540
else ()
36-
target_link_options(${TARGET} INTERFACE "LINKER:-Map=$<TARGET_PROPERTY:NAME>${CMAKE_EXECUTABLE_SUFFIX}.map")
41+
target_link_options(${TARGET} INTERFACE "LINKER:-Map=$<IF:$<BOOL:$<TARGET_PROPERTY:OUTPUT_NAME>>,$<TARGET_PROPERTY:OUTPUT_NAME>,$<TARGET_PROPERTY:NAME>>${CMAKE_EXECUTABLE_SUFFIX}.map")
3742
endif ()
3843
endfunction()
3944

45+
# create a hardware_NAME_headers target (see pico_pico_simple_hardware_headers_target)
46+
# create a hardware_NAME target (see pico_pico_simple_hardware_target)
4047
macro(pico_simple_hardware_target NAME)
4148
pico_simple_hardware_headers_target(${NAME})
4249
pico_simple_hardware_impl_target(${NAME})
4350
endmacro()
4451

52+
# create an INTERFACE library named target, and define LIB_TARGET=1 (upper case) as a compile option
53+
function(pico_add_impl_library target)
54+
add_library(${target} INTERFACE)
55+
string(TOUPPER ${target} TARGET_UPPER)
56+
target_compile_definitions(${target} INTERFACE LIB_${TARGET_UPPER}=1)
57+
endfunction()
58+
59+
# create an INTERFACE library named hardware_NAME_headers INTERFACE library if it doesn't already exist,
60+
# and add include/ relative to the calling directory to the includes.
61+
# and hardware_structs and hardware_claim as dependencies of the library
4562
macro(pico_simple_hardware_headers_target NAME)
4663
if (NOT TARGET hardware_${NAME}_headers)
4764
add_library(hardware_${NAME}_headers INTERFACE)
@@ -54,8 +71,15 @@ macro(pico_simple_hardware_headers_target NAME)
5471
endif()
5572
endmacro()
5673

74+
# create an INTERFACE library named hardware_NAME if it doesn't exist, along with a hardware_NAME_headers
75+
# INTERFACE library that it depends on. The hardware_NAME_headers library add include/ relative to
76+
# and pico_base_headers, and harddware_structs as a dependency of the library
5777
macro(pico_simple_hardware_headers_only_target NAME)
5878
if (NOT TARGET hardware_${NAME})
79+
# Choosing not to add LIB_HARDWARE_ defines to avoid command line bloat pending a need (they aren't
80+
# super interesting except to determine functionality as they are mostly passive accessors, however
81+
# they could be useful to determine if the header is available.
82+
# pico_add_sdk_impl_library(hardware_${NAME})
5983
add_library(hardware_${NAME} INTERFACE)
6084

6185
target_include_directories(hardware_${NAME} INTERFACE ${CMAKE_CURRENT_LIST_DIR}/include)
@@ -66,8 +90,14 @@ macro(pico_simple_hardware_headers_only_target NAME)
6690
endif()
6791
endmacro()
6892

93+
# create an INTERFACE library named hardware_NAME if it doesn't exist, dependent on a pre-existing hardware_NAME_headers
94+
# INTERFACE library and pico_platform. The file NAME.c relative to the caller is added to the C sources for the hardware_NAME
6995
macro(pico_simple_hardware_impl_target NAME)
7096
if (NOT TARGET hardware_${NAME})
97+
# Choosing not to add LIB_HARDWARE_ defines to avoid command line bloat pending a need (they aren't
98+
# super interesting except to determine functionality as they are mostly passive accessors, however
99+
# they could be useful to determine if the header is available.
100+
# pico_add_sdk_impl_library(hardware_${NAME})
71101
add_library(hardware_${NAME} INTERFACE)
72102

73103
target_sources(hardware_${NAME} INTERFACE
@@ -86,4 +116,6 @@ function(pico_add_doxygen_exclude SOURCE_DIR)
86116
set(PICO_DOXYGEN_EXCLUDE_PATHS "${PICO_DOXYGEN_EXCLUDE_PATHS} ${SOURCE_DIR}" CACHE INTERNAL "")
87117
endfunction()
88118

89-
include(${PICO_PLATFORM_CMAKE_FILE})
119+
include(${PICO_PLATFORM_CMAKE_FILE})
120+
121+
pico_promote_common_scope_vars()

targets/TARGET_RASPBERRYPI/TARGET_RP2040/pico-sdk/board_setup.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# PICO_CMAKE_CONFIG: PICO_BOARD, The board name being built for. This is overridable from the user environment, type=string, default=rp2040, group=build
1+
# PICO_CMAKE_CONFIG: PICO_BOARD, The board name being built for. This is overridable from the user environment, type=string, default=pico, group=build
22
if (DEFINED ENV{PICO_BOARD})
33
set(PICO_BOARD $ENV{PICO_BOARD})
44
message("Using PICO_BOARD from environment ('${PICO_BOARD}')")
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
/*
2+
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
3+
*
4+
* SPDX-License-Identifier: BSD-3-Clause
5+
*/
6+
7+
// -----------------------------------------------------
8+
// NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO
9+
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
10+
// -----------------------------------------------------
11+
12+
#ifndef _BOARDS_ADAFRUIT_FEATHER_RP2040_H
13+
#define _BOARDS_ADAFRUIT_FEATHER_RP2040_H
14+
15+
// For board detection
16+
#define ADAFRUIT_FEATHER_RP2040
17+
18+
// On some samples, the xosc can take longer to stabilize than is usual
19+
#ifndef PICO_XOSC_STARTUP_DELAY_MULTIPLIER
20+
#define PICO_XOSC_STARTUP_DELAY_MULTIPLIER 64
21+
#endif
22+
23+
//------------- UART -------------//
24+
#ifndef PICO_DEFAULT_UART
25+
#define PICO_DEFAULT_UART 0
26+
#endif
27+
28+
#ifndef PICO_DEFAULT_UART_TX_PIN
29+
#define PICO_DEFAULT_UART_TX_PIN 0
30+
#endif
31+
32+
#ifndef PICO_DEFAULT_UART_RX_PIN
33+
#define PICO_DEFAULT_UART_RX_PIN 1
34+
#endif
35+
36+
//------------- LED -------------//
37+
#ifndef PICO_DEFAULT_LED_PIN
38+
#define PICO_DEFAULT_LED_PIN 13
39+
#endif
40+
41+
#ifndef PICO_DEFAULT_WS2812_PIN
42+
#define PICO_DEFAULT_WS2812_PIN 16
43+
#endif
44+
45+
//------------- I2C -------------//
46+
#ifndef PICO_DEFAULT_I2C
47+
#define PICO_DEFAULT_I2C 1
48+
#endif
49+
50+
#ifndef PICO_DEFAULT_I2C_SDA_PIN
51+
#define PICO_DEFAULT_I2C_SDA_PIN 2
52+
#endif
53+
54+
#ifndef PICO_DEFAULT_I2C_SCL_PIN
55+
#define PICO_DEFAULT_I2C_SCL_PIN 3
56+
#endif
57+
58+
//------------- SPI -------------//
59+
#ifndef PICO_DEFAULT_SPI
60+
#define PICO_DEFAULT_SPI 0
61+
#endif
62+
63+
#ifndef PICO_DEFAULT_SPI_TX_PIN
64+
#define PICO_DEFAULT_SPI_TX_PIN 19
65+
#endif
66+
67+
#ifndef PICO_DEFAULT_SPI_RX_PIN
68+
#define PICO_DEFAULT_SPI_RX_PIN 20
69+
#endif
70+
71+
#ifndef PICO_DEFAULT_SPI_SCK_PIN
72+
#define PICO_DEFAULT_SPI_SCK_PIN 18
73+
#endif
74+
75+
//------------- FLASH -------------//
76+
77+
// Use slower generic flash access
78+
#define PICO_BOOT_STAGE2_CHOOSE_GENERIC_03H 1
79+
80+
#ifndef PICO_FLASH_SPI_CLKDIV
81+
#define PICO_FLASH_SPI_CLKDIV 4
82+
#endif
83+
84+
#ifndef PICO_FLASH_SIZE_BYTES
85+
#define PICO_FLASH_SIZE_BYTES (8 * 1024 * 1024)
86+
#endif
87+
88+
// All boards have B1 RP2040
89+
#ifndef PICO_RP2040_B0_SUPPORTED
90+
#define PICO_RP2040_B0_SUPPORTED 0
91+
#endif
92+
93+
#endif
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
/*
2+
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
3+
*
4+
* SPDX-License-Identifier: BSD-3-Clause
5+
*/
6+
7+
// -----------------------------------------------------
8+
// NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO
9+
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
10+
// -----------------------------------------------------
11+
12+
#ifndef _BOARDS_ADAFRUIT_ITSYBITSY_RP2040_H
13+
#define _BOARDS_ADAFRUIT_ITSYBITSY_RP2040_H
14+
15+
// For board detection
16+
#define ADAFRUIT_ITSYBITSY_RP2040
17+
18+
// On some samples, the xosc can take longer to stabilize than is usual
19+
#ifndef PICO_XOSC_STARTUP_DELAY_MULTIPLIER
20+
#define PICO_XOSC_STARTUP_DELAY_MULTIPLIER 64
21+
#endif
22+
23+
//------------- UART -------------//
24+
#ifndef PICO_DEFAULT_UART
25+
#define PICO_DEFAULT_UART 0
26+
#endif
27+
28+
#ifndef PICO_DEFAULT_UART_TX_PIN
29+
#define PICO_DEFAULT_UART_TX_PIN 0
30+
#endif
31+
32+
#ifndef PICO_DEFAULT_UART_RX_PIN
33+
#define PICO_DEFAULT_UART_RX_PIN 1
34+
#endif
35+
36+
//------------- LED -------------//
37+
#ifndef PICO_DEFAULT_LED_PIN
38+
#define PICO_DEFAULT_LED_PIN 11
39+
#endif
40+
41+
#ifndef PICO_DEFAULT_WS2812_PIN
42+
#define PICO_DEFAULT_WS2812_PIN 17
43+
#endif
44+
45+
#ifndef PICO_DEFAULT_WS2812_POWER_PIN
46+
#define PICO_DEFAULT_WS2812_POWER_PIN 16
47+
#endif
48+
49+
//------------- I2C -------------//
50+
#ifndef PICO_DEFAULT_I2C
51+
#define PICO_DEFAULT_I2C 0
52+
#endif
53+
54+
#ifndef PICO_DEFAULT_I2C_SDA_PIN
55+
#define PICO_DEFAULT_I2C_SDA_PIN 2
56+
#endif
57+
58+
#ifndef PICO_DEFAULT_I2C_SCL_PIN
59+
#define PICO_DEFAULT_I2C_SCL_PIN 3
60+
#endif
61+
62+
//------------- SPI -------------//
63+
#ifndef PICO_DEFAULT_SPI
64+
#define PICO_DEFAULT_SPI 0
65+
#endif
66+
67+
#ifndef PICO_DEFAULT_SPI_TX_PIN
68+
#define PICO_DEFAULT_SPI_TX_PIN 19
69+
#endif
70+
71+
#ifndef PICO_DEFAULT_SPI_RX_PIN
72+
#define PICO_DEFAULT_SPI_RX_PIN 20
73+
#endif
74+
75+
#ifndef PICO_DEFAULT_SPI_SCK_PIN
76+
#define PICO_DEFAULT_SPI_SCK_PIN 18
77+
#endif
78+
79+
//------------- FLASH -------------//
80+
81+
#define PICO_BOOT_STAGE2_CHOOSE_W25Q080 1
82+
83+
#ifndef PICO_FLASH_SPI_CLKDIV
84+
#define PICO_FLASH_SPI_CLKDIV 2
85+
#endif
86+
87+
#ifndef PICO_FLASH_SIZE_BYTES
88+
#define PICO_FLASH_SIZE_BYTES (8 * 1024 * 1024)
89+
#endif
90+
91+
// All boards have B1 RP2040
92+
#ifndef PICO_RP2040_B0_SUPPORTED
93+
#define PICO_RP2040_B0_SUPPORTED 0
94+
#endif
95+
96+
#endif
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
/*
2+
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
3+
*
4+
* SPDX-License-Identifier: BSD-3-Clause
5+
*/
6+
7+
// -----------------------------------------------------
8+
// NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO
9+
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
10+
// -----------------------------------------------------
11+
12+
#ifndef _BOARDS_ADAFRUIT_QTPY_RP2040_H
13+
#define _BOARDS_ADAFRUIT_QTPY_RP2040_H
14+
15+
// For board detection
16+
#define ADAFRUIT_QTPY_RP2040
17+
18+
// On some samples, the xosc can take longer to stabilize than is usual
19+
#ifndef PICO_XOSC_STARTUP_DELAY_MULTIPLIER
20+
#define PICO_XOSC_STARTUP_DELAY_MULTIPLIER 64
21+
#endif
22+
23+
//------------- UART -------------//
24+
#ifndef PICO_DEFAULT_UART
25+
#define PICO_DEFAULT_UART 1
26+
#endif
27+
28+
#ifndef PICO_DEFAULT_UART_TX_PIN
29+
#define PICO_DEFAULT_UART_TX_PIN 20
30+
#endif
31+
32+
#ifndef PICO_DEFAULT_UART_RX_PIN
33+
#define PICO_DEFAULT_UART_RX_PIN 5
34+
#endif
35+
36+
//------------- LED -------------//
37+
// No normal LED
38+
// #define PICO_DEFAULT_LED_PIN 13
39+
40+
#ifndef PICO_DEFAULT_WS2812_PIN
41+
#define PICO_DEFAULT_WS2812_PIN 12
42+
#endif
43+
44+
#ifndef PICO_DEFAULT_WS2812_POWER_PIN
45+
#define PICO_DEFAULT_WS2812_POWER_PIN 11
46+
#endif
47+
48+
//------------- I2C -------------//
49+
#ifndef PICO_DEFAULT_I2C
50+
#define PICO_DEFAULT_I2C 0
51+
#endif
52+
53+
#ifndef PICO_DEFAULT_I2C_SDA_PIN
54+
#define PICO_DEFAULT_I2C_SDA_PIN 24
55+
#endif
56+
57+
#ifndef PICO_DEFAULT_I2C_SCL_PIN
58+
#define PICO_DEFAULT_I2C_SCL_PIN 25
59+
#endif
60+
61+
//------------- SPI -------------//
62+
#ifndef PICO_DEFAULT_SPI
63+
#define PICO_DEFAULT_SPI 0
64+
#endif
65+
66+
#ifndef PICO_DEFAULT_SPI_TX_PIN
67+
#define PICO_DEFAULT_SPI_TX_PIN 3
68+
#endif
69+
70+
#ifndef PICO_DEFAULT_SPI_RX_PIN
71+
#define PICO_DEFAULT_SPI_RX_PIN 4
72+
#endif
73+
74+
#ifndef PICO_DEFAULT_SPI_SCK_PIN
75+
#define PICO_DEFAULT_SPI_SCK_PIN 6
76+
#endif
77+
78+
//------------- FLASH -------------//
79+
80+
#define PICO_BOOT_STAGE2_CHOOSE_W25Q080 1
81+
82+
#ifndef PICO_FLASH_SPI_CLKDIV
83+
#define PICO_FLASH_SPI_CLKDIV 2
84+
#endif
85+
86+
#ifndef PICO_FLASH_SIZE_BYTES
87+
#define PICO_FLASH_SIZE_BYTES (8 * 1024 * 1024)
88+
#endif
89+
90+
// All boards have B1 RP2040
91+
#ifndef PICO_RP2040_B0_SUPPORTED
92+
#define PICO_RP2040_B0_SUPPORTED 0
93+
#endif
94+
95+
#endif

0 commit comments

Comments
 (0)