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)
This commit is contained in:
parent
d36b1ca8ae
commit
fe3408b286
@ -52,8 +52,9 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
option(PICO_DEOPTIMIZED_DEBUG "Build debug builds with -O0" 0)
|
||||
|
||||
# todo move to platform/Generix-xxx
|
||||
set(ARM_GCC_COMMON_FLAGS " -march=armv6-m -mcpu=cortex-m0plus -mthumb")
|
||||
#set(ARM_GCC_COMMON_FLAGS " -mcpu=cortex-m0plus -mthumb")
|
||||
|
||||
# on ARM -mcpu should not be mixed with -march
|
||||
set(ARM_GCC_COMMON_FLAGS " -mcpu=cortex-m0plus -mthumb")
|
||||
foreach(LANG IN ITEMS C CXX ASM)
|
||||
set(CMAKE_${LANG}_FLAGS_INIT "${ARM_GCC_COMMON_FLAGS}")
|
||||
if (PICO_DEOPTIMIZED_DEBUG)
|
||||
|
@ -25,7 +25,7 @@ typedef unsigned int uint;
|
||||
\see update_us_since_boot()
|
||||
\ingroup timestamp
|
||||
*/
|
||||
#ifndef NDEBUG
|
||||
#ifdef NDEBUG
|
||||
typedef uint64_t absolute_time_t;
|
||||
#else
|
||||
typedef struct {
|
||||
@ -40,7 +40,7 @@ typedef struct {
|
||||
* \ingroup timestamp
|
||||
*/
|
||||
static inline uint64_t to_us_since_boot(absolute_time_t t) {
|
||||
#ifndef NDEBUG
|
||||
#ifdef NDEBUG
|
||||
return t;
|
||||
#else
|
||||
return t._private_us_since_boot;
|
||||
@ -55,7 +55,7 @@ static inline uint64_t to_us_since_boot(absolute_time_t t) {
|
||||
* \ingroup timestamp
|
||||
*/
|
||||
static inline void update_us_since_boot(absolute_time_t *t, uint64_t us_since_boot) {
|
||||
#ifndef NDEBUG
|
||||
#ifdef NDEBUG
|
||||
*t = us_since_boot;
|
||||
#else
|
||||
assert(us_since_boot <= INT64_MAX);
|
||||
@ -63,7 +63,7 @@ static inline void update_us_since_boot(absolute_time_t *t, uint64_t us_since_bo
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
#ifdef NDEBUG
|
||||
#define ABSOLUTE_TIME_INITIALIZED_VAR(name, value) name = value
|
||||
#else
|
||||
#define ABSOLUTE_TIME_INITIALIZED_VAR(name, value) name = {value}
|
||||
|
@ -18,6 +18,10 @@
|
||||
* \ingroup pico_util
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
spin_lock_t *lock;
|
||||
uint8_t *data;
|
||||
@ -69,7 +73,7 @@ void queue_free(queue_t *q);
|
||||
static inline uint queue_get_level_unsafe(queue_t *q) {
|
||||
int32_t rc = (int32_t)q->wptr - (int32_t)q->rptr;
|
||||
if (rc < 0) {
|
||||
rc += + q->element_count + 1;
|
||||
rc += q->element_count + 1;
|
||||
}
|
||||
return (uint)rc;
|
||||
}
|
||||
@ -181,4 +185,7 @@ void queue_remove_blocking(queue_t *q, void *data);
|
||||
*/
|
||||
void queue_peek_blocking(queue_t *q, void *data);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
@ -60,7 +60,7 @@ static bool resetd_control_request_cb(uint8_t __unused rhport, tusb_control_requ
|
||||
|
||||
#if PICO_STDIO_USB_RESET_INTERFACE_SUPPORT_RESET_TO_FLASH_BOOT
|
||||
if (request->bRequest == RESET_REQUEST_FLASH) {
|
||||
watchdog_reboot(0, SRAM_END, PICO_STDIO_USB_RESET_RESET_TO_FLASH_DELAY_MS);
|
||||
watchdog_reboot(0, 0, PICO_STDIO_USB_RESET_RESET_TO_FLASH_DELAY_MS);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
@ -10,12 +10,13 @@
|
||||
#include "pico/time.h"
|
||||
#include "pico/stdio/driver.h"
|
||||
#include "pico/binary_info.h"
|
||||
#include "pico/mutex.h"
|
||||
#include "hardware/irq.h"
|
||||
|
||||
static_assert(PICO_STDIO_USB_LOW_PRIORITY_IRQ > RTC_IRQ, ""); // note RTC_IRQ is currently the last one
|
||||
static mutex_t stdio_usb_mutex;
|
||||
|
||||
static void low_priority_worker_irq() {
|
||||
static void low_priority_worker_irq(void) {
|
||||
// if the mutex is already owned, then we are in user code
|
||||
// in this file which will do a tud_task itself, so we'll just do nothing
|
||||
// until the next tick; we won't starve
|
||||
|
@ -83,6 +83,7 @@ int main(void) {
|
||||
dma_channel_configure(0, &config, &dma_to, &dma_from, 1, true);
|
||||
dma_channel_set_config(0, &config, false);
|
||||
|
||||
// note this loop expects to cause a breakpoint!!
|
||||
for (int i = 0; i < 20; i++) {
|
||||
puts("sleepy");
|
||||
sleep_ms(1000);
|
||||
@ -94,4 +95,6 @@ int main(void) {
|
||||
irq_remove_handler(DMA_IRQ_1, dma_handler_b);
|
||||
}
|
||||
}
|
||||
// this should compile as we are Cortex M0+
|
||||
__asm volatile("SVC #3");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user