Commit Graph

409 Commits

Author SHA1 Message Date
Andrew Scheller
d0c7642369
Update ADC ENOB comment to match (measured) value in RP2040 datasheet (#643) 2021-10-30 08:29:58 -05:00
Graham Sanderson
e4d6ff9ecd
Small PICO_PLATFORM=host fixes (#639) 2021-10-28 15:16:36 -05:00
Andrew Scheller
da7c39bc23
Fix some of the (simpler) errors reported by the doxygen command (#617) 2021-10-26 16:09:06 -05:00
Graham Sanderson
b04a09110f
revert additional assertion check which breaks used of hw_alias macro outside of functions (#635)
* revert additional assertion check which breaks used of hw_alias macros outside of functions
2021-10-26 16:07:21 -05:00
Graham Sanderson
5641cd0a4a
__aeabi_memset* were switching the wrong arguments (#634) 2021-10-26 13:47:46 -05:00
Engineer_Will
68555c9751
Added some waveshare boards definition (#619) 2021-10-26 13:47:01 -05:00
Graham Sanderson
e5110dfce1
add docs for pio_instructions.h (#624)
Co-authored-by: Andrew Scheller <andrew.scheller@raspberrypi.com>
2021-10-26 13:45:32 -05:00
Graham Sanderson
e850214938
Platform updates (#611)
* Platform updates
 - Add PICO_RP2040=1 to rp2040 builds
 - Add new PICO_RP2040_B0/1/2_SUPPORTED macros and retailer chip specific code to use
 - Add doxygen to platform.h
 - Make pico.h includable from assembly (because header order is important and tricky) - split out platform_asm.h
 - Switch to using PICO_RP2040_B0_SUPPORTED in board headers
2021-10-25 12:26:06 -05:00
Graham Sanderson
723dfd04ff
add more/better documentation to pico/multicore (#620) 2021-10-25 12:23:41 -05:00
Graham Sanderson
05418b4e71
fix minor bug in add_repeating_timer_us, and add some comments (#621) 2021-10-25 09:32:02 -05:00
Graham Sanderson
0ccd0db163
Update to TinyUSB 0.12.0 (#622)
Update kitchent_sink compilation test to include TinyUSB to catch warnings
Fix warnings in stdio_usb and stdio_semihosting caught by above
2021-10-25 08:33:42 -05:00
Graham Sanderson
3c72e753b6
Split recursive mutex into their own functions (was Reduce performance hit of recursive mutex) (#495)
mutex_t and mutex_ are reverted to non recursive versions (pre SDK1.2.0) and new recursive_mutex_t and recursive_mutex_ functions have been added

PICO_MUTEX_ENABLE_SDK120_COMPATIBILITY flag has been added to allow old SDK1.2.0 compatibility (i.e. mutex_t can be used recursively or not) but this is slower (and is will be removed in a future version)
2021-10-20 18:27:59 -05:00
Graham Sanderson
9320d192c3
add watchdog_enable_caused_reboot (minor compatibility issue) (#594)
add watchdog_enable_caused_reboot. Note there is a small backwards incompatibility in so far as watchdog_enable sets scratch[4] to a magic value not 0 now, however this behavior was not documented before.
2021-10-20 17:30:24 -05:00
Graham Sanderson
68571ad33e
Hardware struct regeneration (#613)
* Use reg[0] description for hardware structs register arrays

* Update struct headers to match SVD and latest svd2struct
2021-10-14 15:35:28 -05:00
Andrew Scheller
a0450d0133
Updated reg_headers and SVD (#612) 2021-10-14 12:21:14 -05:00
Robert Pafford
3c94bc8137
Change _watchdog_enable to trigger immediate reboot when no delay set (#561) 2021-10-14 11:30:16 -05:00
Graham Sanderson
f808b5f2dc
Add DREQ methods for PWM/SPI/UART/I2C (#603) 2021-10-12 16:04:16 -05:00
Graham Sanderson
2f2e62968d
Use auto-generated hardware/structs/ headers (based off SVD) SVD errors fixed. 2021-10-12 09:15:19 -05:00
Graham Sanderson
ec4036181f
tweak info message for TinyUSB support (#590) 2021-10-12 09:09:09 -05:00
Graham Sanderson
db47fba48d
respect OUTPUT_NAME target property when generating supplemental files (#592) 2021-10-12 09:08:44 -05:00
Graham Sanderson
a0d4bdf731
fix pico_set_printf_implementation(TARGET compiler) (#593) 2021-10-12 09:08:15 -05:00
Graham Sanderson
d50e743e0e
make type punning of floating point/int in float_math and double_math use union to avoid warnings (#600) 2021-10-12 09:07:36 -05:00
Graham Sanderson
30673fb6d0
move inline assembly constant out into C code so it doesn't get out of range in a large function (#602) 2021-10-12 09:07:06 -05:00
Graham Sanderson
e76d5a9008
add dma_timer related methods (#604) 2021-10-12 09:04:59 -05:00
Graham Sanderson
9f1c37318b
add irq_get_priority method - improve efficiency of irq_init_priorities (#609) 2021-10-12 09:04:04 -05:00
Liam Fraser
4c9ba3e8ad
USB: Fix description of Length 0 in dpram_regs. Fixes #541 (#608) 2021-10-11 13:21:31 -05:00
Andrew Scheller
ace97f3387
More accurate register access-types and reset-values (#601)
* More accurate register access-types and reset-values

* I2C configuration constants are now included in the autogenerated header
2021-10-08 15:19:41 -05:00
Graham Sanderson
0fa58ed219
Adding/propage macros/signature typedefs for ROM functions. Make rom_func_lookup non-flash safe for flash functions (#586)
* add typedef signatures and ROM code defines for bootrom functions. Propogate uses thru SDK code. Add _inline version of rom_func_lookup
2021-10-08 09:02:19 -05:00
Graham Sanderson
13be546dc3
pico_stdio improvements (#598)
* add stdio_usb_connected() method
* add PICO_STDIO_USB_CONNECT_WAIT_TIMEOUT_MS to allow waiting for CDC connection during init(* 
* add puts_raw and putchar_raw to skip any CR/LF translation
2021-10-08 09:01:30 -05:00
Andrew Scheller
12017a07ab
SPINLOCK regs are RW. (#599) 2021-10-07 18:51:28 -05:00
Graham Sanderson
9319ab11d9
Add xip window alias macros (#566) (#585) 2021-10-07 08:18:02 -05:00
Graham Sanderson
62854f5eff
shrink max-page-size for linker to more sensible 4096 by default (#587) 2021-10-07 08:17:32 -05:00
Graham Sanderson
13ed99df0d
split out usb_reset_interface header into its own library for consumption by picotool or others (#589) 2021-10-07 08:17:13 -05:00
Graham Sanderson
0fdf543126
Missing extern C in datetime.h #581 (#584) 2021-10-04 15:17:00 -05:00
Matias Silva
3c53029c24
Fix some typos (#517) 2021-10-04 13:29:22 -05:00
Manuel Wick
ce0db40223
adafruit_feather_rp2040: Fix default I2C instance (#526)
Use i2c1 as default, because the default pins can't be muxed to i2c0.
2021-10-04 13:28:21 -05:00
Brian Starkey
a119b5bd9f
Fix semihosting_putc (#530)
Per the Arm semihosting protocol documentation[1], the SYS_WRITEC command
expects *a pointer to* the character to be printed in r1, not the
character itself.

[1] https://developer.arm.com/documentation/dui0471/g/Semihosting/SYS-WRITEC--0x03-?lang=en
2021-10-04 13:24:50 -05:00
ZodiusInfuser
eb42ecfaa5
Added definitions for some upcoming Pimoroni LED driver boards (#535)
* Added definitions for Plasma and Interstate boards

* Tweak to interstate pinout
2021-10-04 13:24:31 -05:00
Martino Facchin
cd4e53a202
Use W25Q080 second stage loader for Nano RP2040 Connect (#537)
Due to the well known electronic market situation, we were forced to mount an alternative part number in a batch of Arduino Nano RP2040 Connect.
These flash chips, from ISSI, need yet another way to configure the QE sticky bit :|
At the moment, the safest way to handle the dual sourcing is to fallback using W25Q080 loader, and requiring that the sticky bit has already been programmed during production.
2021-10-04 13:23:18 -05:00
Andrew Scheller
f63a14e9ee
Change PWM_CH1_DIV_INT_LSB to PWM_CH0_DIV_INT_LSB (#560)
For consistency with all the other PWM_...._LSB constants
2021-10-04 13:21:55 -05:00
Mike Causer
2214468b51
Add Adafruit Trinkey QT2040 board (#525) 2021-10-04 13:11:45 -05:00
Andrew Scheller
e6b8c7b64e
bugfix: "WO" registers should be listed in the SVD as write-only, not read-write (#544) 2021-10-04 13:10:42 -05:00
Brian Starkey
1d0dcc8177
pico_time: Fix alarm_pool_dump_key format string (#557)
Add requred "%" before PRIu64.

pico-sdk/src/common/pico_time/time.c:282:20: warning: data argument not used by format string [-Wformat-extra-args]
2021-10-04 13:09:59 -05:00
Brian Starkey
46d8597d35
Add hardware_divider to pico_divider dependencies (#571)
Fixes build when pico_stdlib isn't included in the target libraries:
  pico-sdk/src/rp2_common/pico_divider/divider.S:8:10: fatal error: hardware/divider_helper.S: No such file or directory

Also fixes the same error in pico_double, though I'm not sure how/why:
  pico-sdk/src/rp2_common/pico_double/double_aeabi.S:9:10: fatal error: hardware/divider_helper.S: No such file or directory
2021-10-04 13:09:43 -05:00
Mahyar Koshkouei
d7feac1495
Fix syntax error in cmake when using custom stage2 (#580)
Signed-off-by: Mahyar Koshkouei <mk@deltabeard.com>
2021-10-04 13:09:23 -05:00
Leonardo La Rocca
ca232e9404
Add Melopero Shake RP2040 Board header file (#565)
* added melopero shake definition
2021-10-04 13:07:16 -05:00
dp111
c08136b696
Move ret_dzero to the same section as it get used (#513) 2021-08-11 09:24:23 -05:00
Andrew Scheller
672d18a6f0
Fix default PICO_BOARD value (#536) 2021-08-06 12:21:59 -05:00
Luke Wren
2622e9bc29 Enable UART RX timeout IRQ, as well as RX IRQ, so that individual characters can be received. 2021-07-22 14:46:29 +01:00
Luke Wren
9a586371db
Add doxygen clarifying PWM behaviour when enabled/disabled, and advice for controlling the pin state when disabled (#521) 2021-07-19 10:21:12 -05:00
Matias Silva
7e90980118
Add explanatory note on 7-bit I2C addresses (#520) 2021-07-19 12:02:19 +01:00
Matias Silva
ae6e574f53
Improve wording of comments in irq.h (#509) 2021-07-15 09:32:45 +01:00
Graham Sanderson
5e05469373
bug in sleep_until on host mode for macOS (#502) 2021-07-06 12:19:39 -05:00
Liam Fraser
dc4342f0f6 Update usb regs to fix https://github.com/raspberrypi/pico-feedback/issues/172 2021-07-06 17:02:33 +01:00
Graham Sanderson
35b4965054
make sure PICO_DEFAULT_BOOT_STAGE2_FILE is defined in parent CMake file (#491) 2021-07-06 16:56:17 +01:00
graham sanderson
e02c6b327d Allow one of float/double to have 'none' impl but not the other - previously caused a link error 2021-07-06 16:24:46 +01:00
graham sanderson
f4ab723eb5 compile failure with PICO_STDOUT_MUTEX=0 2021-07-06 16:06:52 +01:00
Graham Sanderson
cefe5c5b2a
Better support for PICO_DISABLE_SHARED_IRQ_HANDLERS (#496)
* use PICO_DISABLE_SHARED_IRQ_HANDLERS exclusively as config for no shared handler support (rather than also PICO_MAX_SHARED_IRQ_HANDLERS == 0)
additionally make irq_add_shared_irq_handler() call irq_set_exclusive_handler() so that single usage of an IRQ still works

* Comment typo

Co-authored-by: Luke Wren <wren6991@gmail.com>
2021-06-29 11:55:35 -05:00
Luke Wren
edcb65c916
Enable I2C FIFO full hold in slave mode (stretch clock when RX full), fixes #456 (#494) 2021-06-29 11:55:01 -05:00
Andrew Scheller
f16ccfa1ff Small comment typos 2021-06-29 10:57:21 +01:00
graham sanderson
44feae4caf set DIVISOR for each use of h/w divider 2021-06-29 10:55:14 +01:00
Zapta
61b7cbdc54
Using ' inline __always_inline' also for GNUC 7. (#484)
Per the discussion at https://www.raspberrypi.org/forums/viewtopic.php?f=145&t=313961
2021-06-28 16:07:48 -05:00
Luke Wren
1f1c6162cd
Header info string updates for PIO DBG_PADx and XOSC STARTUP (#478) 2021-06-04 10:39:00 -05:00
graham sanderson
979045dc12 removed CMSIS from SDK doxygen 2021-06-03 16:46:19 -05:00
Brian Cooke
d42e6a9d10
include pico.h so that uint is defined (#475) 2021-06-03 15:22:28 -05:00
graham sanderson
fdf695b8d8 remove incorrect default from PICO_PANIC_FUNCTION PICO_CONFIG entry 2021-06-03 10:42:31 -05:00
graham sanderson
45a1e08265 fix sem_acquire_block_until function name 2021-06-03 10:36:48 -05:00
ZodiusInfuser
c44e62defd
Added board definition (#471) 2021-06-03 10:24:12 -05:00
Luke Wren
bba0420c76
Add gpio_set_irqover to match inover/outover/oeover (fixes #265) (#470) 2021-06-03 08:37:06 -05:00
Ha Thach
eeb6b501ff
fix qtpy rp2040 uart rx rev B (#466)
also add static check for USB DPRAM
2021-06-02 14:00:29 -05:00
Graham Sanderson
5afa3636d6
Small API additions and minor fixes (#406)
* Add missing DREQ_s

* store actual clock frequency in clock_configure (fixes #368)

* use dma DREQ values defined in dreqs/dma.h

* Fix hw_is_claimed, and add xxx_is_claimed APIs

* Add some PIO irq helper methods

* Add DMA channel IRQ status getter and clear methods

* Implement the correct PIO IRQ status/clear methods (good to have methods here as the h/w interrupt registers are super confusing)

* fix pico_multicore dependencies

* add missing wrapper func __aeabi_f2d

* Further DMA/PIO IRQ API cleanup (and review fixes)

* add PICO_INT64_OPS_IN_RAM flag
2021-06-02 13:12:27 -05:00
Graham Sanderson
91e9327ff1
Add PICO_PANIC_FUNCTION define to allow replacement of the default panic function (#463) 2021-06-02 13:04:38 -05:00
Liam Fraser
b3e1d2d8b8
Add usb device dpram to svd file. Fixes #351 (#465) 2021-06-02 13:04:27 -05:00
Graham Sanderson
561502c2da
Move to Tinyusb 0.10.0 (still with RP patches) (#462)
Most build related items have moved into <tinyusb>/hw/bsp/rp2040/family.cmake which is now the source of truth

force merging as same code save submodule was already reviewed
2021-06-02 13:04:08 -05:00
graham sanderson
496ff66d19 Make PICO_CONFIG descriptions unique 2021-06-02 16:14:11 +01:00
graham sanderson
66c54d807b fix PICO_CONFIG entry 2021-06-02 16:14:11 +01:00
graham sanderson
27c1a89b3d review fixes 2021-06-02 16:14:11 +01:00
graham sanderson
895bad790e Add some spin lock related doxygen 2021-06-02 16:14:11 +01:00
Luke Wren
30041d8513
Add hardware_gpio accessors for Schmitt, slew rate, drive strength (fixes #290) (#464) 2021-06-01 14:25:11 -05:00
Dan Halbert
d026118499
Allow lengthening xosc startup delay with a compile option (#457) 2021-06-01 14:24:40 -05:00
Rene
42cbdcb13a
added spi_get_baudrate() + some consistency changes (#395)
* added spi_get_baudrate()
2021-06-01 11:12:15 -05:00
geurtv
1996a21e3a
dma_channel_transfer_[from/to]_buffer_now: added const volatile to read_addr and volatile to write_addr (#449) 2021-05-27 12:12:39 -05:00
Brendan
e0872a32cc
Add missing board detection macros (#448)
* add board detection macros for Sparkfun & RPi Pico / VGA Board
2021-05-27 11:55:38 -05:00
Jonathan Reichelt Gjertsen
5ad072af5b
Add function to get the currently selected channel (#451)
This is most useful in combination with round-robin sampling to avoid
having to track it manually.
2021-05-27 07:25:40 -05:00
Rene
6994a3858d
-some typo fixes (#408)
-small consistency changes
2021-05-24 16:56:56 -05:00
Rene
2eb76bb058
- interp_ fixes (#428)
* - fix interp_claim_lane (in case of interp1 and lane==1 bit was 0b11 instead of 0b1000)
- added missing function interp_unclaim_lane_mask

* - interp_hw_save_t are not I/O registers
2021-05-24 16:56:11 -05:00
Jonathan Reichelt Gjertsen
b8dc054eba
queue: make data pointers const in queue_try_add and queue_add_blocking (#423)
The only operation done on the data pointer is to pass it into the second
argument of memcpy, which is `const void *`
2021-05-24 16:52:49 -05:00
Jonathan Reichelt Gjertsen
cc8b2156fb
Define void operator delete[](void *p, std::size_t n) in new_delete.cpp (#430) 2021-05-24 16:47:29 -05:00
Jonathan Reichelt Gjertsen
048fcdefd6
Prevent warnings about some unused parameters in pico_stdio_usb when building with -Wextra (#431)
* Fix warnings about some unused parameters in pico_stdio_usb

* Use `__unused` for the unused parameter in tud_descriptor_configuration_cb

* Remove redundant inclusions of `pico/platform.h`

This header is included by the other library headers (via `pico.h`)
2021-05-24 16:42:28 -05:00
Jonathan Reichelt Gjertsen
80356a4f02
Define __STRING for other compilers than MSVC in the host platform.h file (#434) 2021-05-24 16:40:29 -05:00
Jonathan Reichelt Gjertsen
d79dd219ce
Implement uart_write_blocking and uart_read_blocking for host (#438) 2021-05-24 16:37:31 -05:00
Jonathan Reichelt Gjertsen
94b83315d9
Update host multicore.h to match multicore.h in rp2_common (#439) 2021-05-24 16:35:11 -05:00
Andrew Scheller
777ccb8e56
Fix function-name misspelling (#443)
If "init tty" is `_inittty` then "reset tty" ought to be `_resettty`
2021-05-24 16:34:23 -05:00
Martino Facchin
17ee1a877d
Add support for Arduino Nano RP2040 Connect (#425)
* Add support for Arduino Nano RP2040 Connect

* Add support for at25sf128a flash

Derived from W25Q080 code, QE bit is set via a single command
2021-05-24 16:32:56 -05:00
Jonathan Reichelt Gjertsen
b2832b3acb
Fix wrong format string in alarm_pool_dump_key (#437)
Fixes the following warning when building for host

```
[...]/pico-sdk/src/common/pico_time/time.c: In function 'alarm_pool_dump_key':
[...]/pico-sdk/src/common/pico_time/time.c:282:15: warning: format '%ld' expects argument of type 'long int', but argument 2 has type 'uint64_t' {aka 'long long unsigned int'} [-Wformat=]
     printf("%ld", to_us_since_boot(get_entry(pool, id)->target));
             ~~^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             %I64d
```
2021-05-24 16:32:31 -05:00
Jonathan Reichelt Gjertsen
060123dc8d
Optional feature to get the max level that has ever been held by a queue (#444)
I'm using this in my program to get a better idea of how many entries I
need to allocate to avoid blocking or losing data, and to debug performance
issues.
2021-05-24 16:31:30 -05:00
Jonathan Reichelt Gjertsen
596d08ea62
Add missing cast to uint32_t in hw_divider_u32_quotient for host (#436)
Fixes the following warning:

```
[...]/pico-sdk/src/host/hardware_divider/include/hardware/divider.h:81:26: warning: operand of ?: changes signedness from 'int' to 'uint32_t' {aka 'unsigned int'} due to unsignedness of other operand [-Wsign-compare]
     return b ? (a / b) : -1;
                          ^~
```
2021-05-23 08:21:09 -05:00
Joni Kähärä
5384b6b4d3 add comment about using clk_gpout0 enable bit (Fixes #413) 2021-05-17 09:12:41 +01:00
Graham Sanderson
574fdee37b
Fixup divider save_restore for floating point too; improve tests (#405)
- The divider state needs to be saved for __aeabi_ddiv, __aeabi_fdiv, __aeabi_dtan and __aeabi_ftan or they won't work in interrupts *(probably not used much youd hope), or on an RTOS context switch
 - Refactored code out for the integer and floating point cases
 - Improved the floating point 'tests' in passing to check more return values against GCC implementations
 - Added floating point usage to the IRQ nesting test case
2021-05-13 07:38:42 -05:00
Graham Sanderson
c6c4eeb122
add timeout_us/until to mutex/sem blocking methods (#402) 2021-05-12 16:32:45 -05:00
Andrew Scheller
54c78bf985
Fix the PICO_CONFIG default value for PICO_CMSIS_RENAME_EXCEPTIONS (#399) 2021-05-11 19:21:44 -05:00
Graham Sanderson
b05d863428
Add basic CMSIS core headers (#384)
Adds a new cmsis_core INTERFACE library, which provides the basic CMSIS macros/definitions, and RP2040.h and system_RP2040.h
By default the isr_ methods in the vector table are renamed to their CMSIS versions, but this can be overridden by defining PICO_CMSIS_RENAME_EXCEPTIONS=0
2021-05-11 10:47:13 -05:00
Graham Sanderson
6182a2a078
make host pico_platform.h and binary_info.h CMakeLists.txt safe for inclusion in non SDK build (#388)
* make host pico_platform.h and binary_info.h CMakeLists.txt safe for inclusion in non SDK build

* fix comment
2021-05-11 10:37:49 -05:00
Graham Sanderson
508828f8ea
allow setting exception handler to the same value, as this might happen if exceptions are set dynamically on both cores, but VTOR is the same... this should indeed cause an error if the values differ, but not otherwise (#385) 2021-05-11 10:34:41 -05:00
Graham Sanderson
36dda1c5c4
Fix some hardware_library dependencies (#383) 2021-05-11 10:34:11 -05:00
Graham Sanderson
e57b99a652
Rework ordering of cmake, so that libraries in subdirectories can add to internal lists as PICO_SDK_POST_LIST_FILES, PICO_CONFIG_HEADER_FILES etc. (#382)
Move generation of config header later, so it gets to include all values for PICO_CONFIG_HEADER_FILES
2021-05-11 10:33:34 -05:00
Andrew Scheller
9396b9c7e1
Fix a bunch of doxygen typos (#391) 2021-05-10 08:48:09 -05:00
Andrew Scheller
ecf66bf514
Correct doxygen for mutex_try_enter (#392) 2021-05-10 08:47:23 -05:00
Andrew Scheller
114dc5a80d
Fixup IRQ_PRIORITY #define values (#393)
Related to #245
2021-05-10 08:46:53 -05:00
Graham Sanderson
8d4f4e148d
remove spurious sys/select.h include (#377) 2021-05-05 11:51:18 -05:00
Graham Sanderson
6d87da4c59
Rework lock_core / timers (#378)
- Add recursive_mutex
  - Make all locking primitives and sleep use common overridable wait/notify support to allow RTOS
    implementations to replace WFE/SEV with something more appropriate
  - Add busy_wait_ms
2021-05-05 11:46:25 -05:00
Graham Sanderson
ec0dc7a88b
add __always_inline to trivial super low level inline functions (#379) 2021-05-05 11:46:07 -05:00
Graham Sanderson
53f1915a6b
Add hardware_exception for setting exception handlers at runtime (#380) 2021-05-05 11:45:39 -05:00
Luke Wren
7fc75d8c90
Definitions for IC_TX_BUFFER_DEPTH inconsistent (fixes #335) (#381) 2021-05-05 11:45:12 -05:00
fivdi
8f3c3ff12a i2c: improve communication with i2c devices in i2c_write_blocking 2021-05-05 14:46:09 +01:00
Graham Sanderson
18c39856bd
Some cmake build improvements (#376)
* Change some cmake output to DEBUG level
Make SDK build more consistent with other libraries (use an INTERFACE marker library for inclusion tests)
Add PICO_SDK_PRE_LIST_FILES, PICO_SDK_POST_LIST_FILES build vars

* fix typo

* remove leftover debugging message
2021-05-04 08:40:11 -05:00
Graham Sanderson
929ede7482
add small delay to stdio_get_until to prevent starvation of USB IRQ handler due to in use mutex. build was non deterministic due to missing link wrapping of getchar (#364) 2021-05-04 08:01:34 -05:00
Graham Sanderson
b7da70a53b
make all non hardware_ libraries foo add C preprocessor definition LIB_FOO=1, and remove bespoke definitions which were all undocumented anyway (#374) 2021-05-04 08:00:17 -05:00
Graham Sanderson
6796faf0d5
add PICO_DIVIDER_DISABLE_INTERRUPTS flag which makes PICO_DIVIDER disable interrupts around division rather than using co-operative guards to protect nested use (i.e. within IRQ/exception). Use of this flag can simplify porting of RTOSes but with a different performance profile (#372) 2021-05-04 07:48:07 -05:00
Graham Sanderson
c979ca591f
disable core 0 SIO FIFO IRQ handler during core 1 launch in case someone has already installed one (#375) 2021-05-04 07:43:25 -05:00
Graham Sanderson
4c83c10f01
make spi_init return baud rate set (#296) 2021-05-01 14:34:28 -05:00
Andrew Scheller
5259693774
Small typos (#366) 2021-05-01 14:32:16 -05:00
Ha Thach
6c4d25b887
correct adafruit flash size for itsybitsy and qt rp2040 (#348)
from 4 MB to 8 MB
2021-04-21 08:26:57 -05:00
Andrew Scheller
b17fc76c8f
Clarify multicore_fifo doxygen (#323)
Based on my observations in #284
2021-04-18 17:10:24 -05:00
Kirk Benell
b8dbbcf0d7
SPI Definitions for SparkFun boards (#344)
* SPI Definitions for SparkFun boards

Added the #defines for the default SPI pins on SparkFun boards

* SPI Definitions for SparkFun boards

Added the #defines for the default SPI pins on SparkFun boards

Co-authored-by: Kirk <blowme@cow.com>
2021-04-18 17:07:35 -05:00
ZodiusInfuser
93d3cf4d8e
Updated existing Pimoroni board headers to match latest style, and added a new board (#343)
* Updated existing pimoroni board headers to newer style from pico.h

* Added new pimoroni board headers

* Fixed incorrect MB and missing _pin

* Removed SPI defaults from Picosystem
2021-04-18 16:13:47 -05:00
Michael Stoops
127543a425
Fixing arithmetic underflow in SPI I/O loops https://github.com/raspberrypi/pico-sdk/issues/337 (#338)
Co-authored-by: Michael Stoops <spam@michaelstoops.com>
2021-04-13 23:06:14 +01:00
Andrew Scheller
9c3538e8b0
Remove MASTER_ON_HOLD bit from I2C status registers. Fix typos. (#326) 2021-04-12 11:15:50 +01:00
Andrew Scheller
ec16d3ff28
Fix param-validation for PIO sideset encoding (#311) 2021-04-12 11:13:22 +01:00
Luke Wren
5fdc663ff8
Fix implementation config listing in structs/i2c.h (#325) 2021-04-09 14:42:06 +01:00
Luke Wren
962da33ea7
Clarify that cache is flushed, but that function is intended for low-level metadata access during startup (#322) 2021-04-09 08:05:29 -05:00
Luke Wren
344b961ebf
Fix implementation config listing in structs/i2c.h (#324) 2021-04-09 08:03:19 -05:00
Scott Shawcroft
814d2bd855
Make flash_do_cmd public (#269)
* Make flash_do_cmd public

* Fix typo in comment
2021-04-09 11:47:16 +01:00
Brian Cooke
f69f513a29
i2c: set high and low times to values that conform to the i2c specification (#314) 2021-04-09 11:00:33 +01:00
Andrew Scheller
4fe995d0ec
Update NULL GPIO function to 0x1f (#320)
Fixes #210
2021-04-08 15:25:01 -05:00
graham sanderson
aabae62caa Merge branch 'master' into develop 2021-04-07 08:29:59 -05:00
Graham Sanderson
92f948c123
Make kitchen_sink check param assertions, and include all headers - fix sign-compare warnings (#316) 2021-04-06 20:50:26 -05:00
Lyle Cheatham
0911393fe2
Changed the parameter check to avoid tripping -Werror on spin locks (#307)
This prevents a comparison between a signed and an unsigned number which
will create a warning tripping -Werror.

Also added a check for the alignment of the spin lock structure
2021-04-06 16:41:57 -05:00
graham sanderson
d974a3b0e9 boot_stage2: cleanup and correctness fixes 2021-04-06 12:47:34 -05:00
Brian Cooke
2e777d47d3
i2c: set hold time of SDA during transmit to an appropriate value (#273)
* i2c: set hold time of SDA during transmit to 2 for TCS34725 color sensor

* i2c: fix issues in i2c_write_blocking_internal

* i2c: rename sda_hold_count to sda_tx_hold_count

* use assert rather than invalid_params_if for internal consistency checks

* i2c: use a more appropriate sda tx hold time at higher baudrates

* i2c: reduce 120/1e9 to the smallest possible integer numerator and denominator

* Don't use implicit 0 for field LSB

Co-authored-by: Luke Wren <wren6991@gmail.com>
2021-04-06 10:57:25 +01:00
majbthrd
162098678b
move PLL reset code from clocks driver to pll driver (#110)
* move PLL reset code from clocks driver to pll driver

* Don't clear PLL PWR/FBDIV after reset as unnecessary. Call out in runtime.c why USB/syscfg aren't reset.

Co-authored-by: Peter Lawrence <12226419+majbthrd@users.noreply.github.com>
Co-authored-by: Luke Wren <wren6991@gmail.com>
2021-04-06 10:42:18 +01:00
Graham Sanderson
fd16563f8f
Merge pull request #299 from raspberrypi/back-merge-1.1.1
Back merge 1.1.1
2021-04-01 17:32:02 -05:00
Graham Sanderson
7f2f186bcc
build: allow board config header to specify bootstage 2 without using custom per board cmake (#293)
* build: allow compile time - and hence via board config header - choice of boot stage2 via a default compile_time_choice.S boot stage 2 which conditionally includes others
adafruit_rp2040_feather: fix flash size/clkdiv

* fixup GENERIC_03H #define names
2021-04-01 16:42:53 -05:00
Graham Sanderson
260128a725
fixup elf2uf2 to allow blocked_ram (flash) binaries (#294) 2021-04-01 15:03:04 -05:00
Earle F. Philhower, III
3c0309c10e
Add pico_get_unique_board_id_string API (#281)
* Add pico_get_unique_board_id_string API

Add a new API to pico_unique which will turn the unique ID into a
canonical text string.

Use this API to update the USB device serial number in stdio_usb.

Supercedes #280

* Clean up -Wconversion=error issues

* Address review comments, fix api typing

Use cleaner binary-to-hex conversion.  Update the length parameter to
use uint per the SDK standard .
2021-03-30 09:04:58 -05:00
Liam Fraser
859d1d27b8
Don't advertise REMOTE_WAKEUP for USB stdio as it is is not currently implemented. Longer term need to implement REMOTE_WAKUP properly in TinyUSB. Similar fix needed in MicroPython to fix MicroPython issue #6866. The symptom is that USB serial will stop working if there is a delay of > 2 seconds ish between messages. We have seen this issue on Linux laptops with USB autosuspend enabled. (#289) 2021-03-30 09:03:28 -05:00
Andrew Scheller
85ac3d7cf8
I2C doxygen typos (#287)
* I2C doxygen typos

* another typo
2021-03-29 11:37:50 -05:00
Tom Wasiluk
c1f164b9fd
corrected clk_gpout3 to gpio pin 25 as per the rp2040 datasheet (#250) 2021-03-24 09:35:02 -05:00
Andrew Scheller
0c941d9767
Tweaks to PIO clkdiv-setting code (#254)
- refactor to reduce duplication
 - add extra param-validation
2021-03-24 09:32:38 -05:00
Mike Bell
a47d6d6e14
Allow heap end to be equal to stack limit (#266) 2021-03-24 09:26:54 -05:00
Andrew Scheller
1d4588a565
Board-header typos (#270) 2021-03-24 09:15:36 -05:00
Luke Wren
98574564b8
Add gpio_get_out_level() accessor, and correct SIO GPIO_OUT struct ty… (#247)
* Add gpio_get_out_level() accessor, and correct SIO GPIO_OUT struct type from WO to RW

* Clean up ambiguous-looking parentheses
2021-03-22 12:54:33 -05:00
Jeff Epler
e9a521a9b1 rtc_get_datetime: read the rtc registers just once each
In order for the returned value to accurately reflect a single moment in time,
ensure the registers are read just once and in the datasheet order.
Before this change, the RTC registers would each be read multiple times,
leading (infrequently) to the returned fields not all reflecting the same
moment in time.

The rp2040 datasheet has what I believe is an incorrect example (embedding
the source of this function); will the datasheet be updated if this function is
fixed?

This problem is only a speculative one; I did not actually observe it in the
wild.
2021-03-22 09:11:51 -05:00
Andrew Scheller
f6d32f87a1
Fix typo in sparkfun_micromod.h (#268) 2021-03-18 14:41:40 -05:00
Graham Sanderson
fe3408b286
Small fixes (#260)
* pico_stdio_usb: be more explicit about includes, fix warning (#257)

* pico_base: NDEBUG backwards for absolute_time_t (#255)

* pico_util: missing extern C in queue.h (#249)

* build: remove -march which was masking -mcpu, now SVC available (#253)
2021-03-17 18:05:48 +00:00
Andrew Scheller
cdf1a956eb
Typo (#251) 2021-03-15 14:29:59 -05:00
Andrew Scheller
336aae518e
Fix ROSC typo (#259)
* Fix ROSC typo

* Additional ROSC typos
2021-03-15 13:57:37 -05:00
Luke Wren
6c1150f3f4
Fix back-to-front description of IRQ priority in doxygen (#245) 2021-03-13 18:08:04 -06:00
Graham Sanderson
d36b1ca8ae
hardware_timer: fix race condition whem a new timer being added becomes missed thus obviating the need for an IRQ but there is an IRQ already pending for another timer (#243) 2021-03-10 12:04:04 -06:00
Andrew Scheller
a2576202ff Add param-validation to spin_lock_instance 2021-03-10 11:06:34 +00:00
Andrew Scheller
26fd36f853 Fixup incorrect doxygen for multicore_fifo_wready 2021-03-10 11:01:51 +00:00
Christian Flach
6f7dc67791
pio: allow programs with 32 instructions (#236) 2021-03-08 12:48:28 -06:00
Graham Sanderson
04ee63428f Remove PICO_FLASH_SIZE_BYTES warning from header as it breaks any build with -Werror; actual uses that care should warn instead (#229) 2021-03-04 21:22:48 -06:00
Andrew Scheller
4c768d2bb8 Add some extra defines to customise behaviour of STDIO_USB_RESET modes (#226)
* Add some extra defines to customise behaviour of STDIO_USB_RESET modes

* Tweaks to STDIO_USB_RESET defines
2021-03-04 21:22:48 -06:00
Andrew Scheller
dff0633c20 Add some extra defines to platform_defs.h (#227) 2021-03-04 21:22:48 -06:00
Andrew Scheller
62b2d33e8f Add PICO_DEFAULT_SPI pins to pico.h (#225)
(and define min and max values for some of the PICO_DEFAULT_* configs)
2021-03-04 21:22:48 -06:00
graham sanderson
6770bd2a46 use _u(0x800) insteand of 0x800u in platform_defs which is included by assembler 2021-03-04 21:22:48 -06:00
Andrew Scheller
1a2bb7c219 Add SPI enums to Doxygen output, fixes #213 (#216)
Also fix a few typos
2021-03-04 21:22:48 -06:00
Andrew Scheller
1413a4f470 Fixup PICO_CONFIG entries (#208)
* remove default=undefined
 * fix a couple of typos / syntax "errors"
 * perform even better default-value-checking in extract_configs.py
2021-03-04 21:22:48 -06:00
Andrew Scheller
fc17f880fd Lots of Doxygen tweaks and fixes (#212)
* Add documentation for gpio_irq_callback_t and rtc_callback_t (fixes #175)
 * Hook up pico_binary_info and pico_bootsel_via_double_reset to the Doxygen index
 * Add link to new Raspberry Pi Pico FAQ
 * Consistently add parentheses for \sa or \see links to function-names
 * Use consistent capitalisation for 'GitHub'
 * Small typos and markup errors
2021-03-04 21:22:48 -06:00
Andrew Scheller
b64cb686ae Remove PICO_SMPS_MODE_PIN from boards/vgaboard.h (#209)
...as it's already present in boards/pico.h
2021-03-04 21:22:48 -06:00
Graham Sanderson
7ee36e3328 Rationalize board header pin defines, and add partner board headers (#192)
* Board definition header files for the iniital set of SparkFun rp2040 boards

* Add default PICO_DEFAULT_I2C*, allow no PICO_DEFAULT_LED_PIN, no PICO_DEFAULT_UART* (instead of -1)
Fixup SparkFun headers

* Pimoroni board headers

* Add LED related board defines PICO_CONFIGs (to pico_stdlib for now)

* more board config changes

* add Adafruit feather, itsybitsy, qtpy board headers

* add PICO_DEFAULT_WS2812_POWER_PIN define

* MOSI/MISO -> TX/RX, some UART cleanup.. make vgaboard.h defines take preference over pico.h ones

* local change to tinyusb to cope with no default LED or UART

* fix review issues

Co-authored-by: Kirk Benell <github-stuff@accvec.com>
Co-authored-by: ZodiusInfuser <christopher.parrott2@gmail.com>
Co-authored-by: hathach <thach@tinyusb.org>
2021-03-04 21:22:48 -06:00
Andrew Scheller
e870582e48 Typo
Set correct name in PICO_CONFIG line for PICO_STDIO_USB_ENABLE_RESET_VIA_VENDOR_INTERFACE
2021-03-04 21:22:48 -06:00
graham sanderson
383e88ea16 Add support for resetting RP2040 via the USB connection when using pico_stdio_usb
- setting baud rate to magic value (default=1200) will cause a reset to BOOTSEL mode
	- a VENDOR interface along side the CDC interface can be used to reset via refular flash boot, or into
	  BOOTSEL mode with control for the reset_usb_boot parameters for the latter
either method can be configured/enabled/disabled via #define
2021-03-04 21:22:48 -06:00
graham sanderson
61e46fefe5 Add binary info 'feature' for pico_bootsel_via_double_reset 2021-03-04 21:22:48 -06:00
graham sanderson
8ada5fa7eb hardware_rtc: make rtc_enable_alarm public 2021-03-04 21:22:48 -06:00
Graham Sanderson
4904fe2e32 remove broken and fairly pointless deep sleep API (#198)
* remove broken and fairly pointless deep sleep API, use multicore_reset_core1 instead

* strict-prototype for multicore_fifo_drain() in host header

* Also for multicore_lockout_victim_init()

Co-authored-by: Luke Wren <wren6991@gmail.com>
2021-03-04 21:22:48 -06:00
Andrew Scheller
f239bd3de5 Fixup PICO_FLASH_SIZE_BYTES PICO_CONFIG entry (no default) 2021-03-04 21:22:48 -06:00
foopub
a989f4f6ee Added ".syntax unified"
Otherwise gcc complains. I've tested this to work with the normal CMakeLists.txt provided in a few examples.
2021-03-04 21:22:48 -06:00
foopub
542b86e5db Replace unavailable flag-preserving instruction
It seems sub requires thumb2 instructions which are unavailable. This is in line with the rest of the sdk code base which uses subs.
2021-03-04 21:22:48 -06:00
graham sanderson
e371f6af60 remove useless PICO_ALLOW_SLEED_IN_EXCEPTION 2021-03-04 21:22:48 -06:00
graham sanderson
aca685ceae panic in debug mode if sleep methods are called in an exception handler (unless PICO_ALLOW_SLEEP_IN_EXCEPTION is set) 2021-03-04 21:22:48 -06:00
Andrew Scheller
6b2c249961 Also check enum params and doxygenise pio_mov_status_type 2021-03-04 21:22:48 -06:00
Andrew Scheller
786be7524a Extra param-checking for hardware_pio library (switch asserts to valid_params_if, and add additional checks) 2021-03-04 21:22:48 -06:00
Andrew Scheller
e5d61f1ad3 Add some "\ingroup timestamp" doxy-comments so that they actually appear in the output! 2021-03-04 21:22:48 -06:00
Andrew Scheller
c1c7197757 Remove duplicate PARAM_ASSERTIONS_ENABLED_SYNC PICO_CONFIG entry 2021-03-04 21:22:48 -06:00
Graham Sanderson
743dbabdec Pico flash size bytes (#159)
* Move PICO_FLASH_SIZE_BYTES out of platform_defs.h since it precedes board config; also default to -1 for unknown

* make default for PICO_FLASH_SIZE_BYTES undefined - i.e. no value
2021-03-04 21:22:48 -06:00
graham sanderson
0d789c9b54 fix compiler warning 2021-03-04 21:22:48 -06:00
graham sanderson
7ed5d87fb1 host mode fixups 2021-03-04 21:22:48 -06:00
graham sanderson
3f5f5a1fd7 pio: improve (slightly) error message for claim failure on PIO 1 2021-03-04 21:22:48 -06:00
graham sanderson
d3fa64afc8 cmake: change warning message for unititialized TinyUSB 2021-03-04 21:22:48 -06:00
Graham Sanderson
e526e4f850 %g should not print 0 as infe-308 (#185) 2021-03-04 21:22:48 -06:00
Andrew Scheller
4335268a93 Default PARAM_ASSERTIONS_ENABLED_LOCK_CORE to 0 (#184)
so that it matches all the other PARAM_ASSERTIONS_* default values
2021-03-04 21:22:48 -06:00
Zachary Kohnen
132d6df695 Add 'hardware/structs/sio.h' header to the 'pico/multicore.h' header\n\nThe pico/multicore.h header uses the sio_hw struct, but does not include the header that defines it. This normally is not a problem since other headers include the structure as well, but since this structure is used in the header, we should not rely on other headers bringing it in and instead include it directly (#176) 2021-03-04 21:22:48 -06:00
Graham Sanderson
e730e03e7f No malloc for default alarm pool an pheap docs/cleanup (#143)
* Statically allocate the default timer pool (to avoid pulling in malloc); doxygen for pheap (and some function name changes)

* fix comments
2021-03-04 21:22:48 -06:00
graham sanderson
0a22f704a6 re-arrange pico/types.h to avoid duplicate doxygen 2021-03-04 21:22:48 -06:00
graham sanderson
228de60da0 fix comment 2021-03-04 21:22:48 -06:00
graham sanderson
684986aae6 fix the represntation of at_the_end_of_time to be 63 one bits rather than 32 2021-03-04 21:22:48 -06:00
graham sanderson
debef7471e Change _U to _u as _U exists in ctype.h 2021-03-04 21:22:48 -06:00
graham sanderson
503bc8b385 Fixup another level of compiler warnings, add _U() definition 2021-03-04 21:22:48 -06:00