1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-16 04:45:24 +03:00

Adding RP2350 SDK and target framework (#13988)

* Adding RP2350 SDK and target framework

* Spacing

* Removing board definitions
This commit is contained in:
J Blackman 2024-10-23 10:02:48 +11:00 committed by GitHub
parent 462cb05930
commit 2dd6f95aad
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
576 changed files with 435012 additions and 0 deletions

View file

@ -0,0 +1,70 @@
/*
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef _PICO_RUNTIME_H
#define _PICO_RUNTIME_H
#include "pico.h"
/** \file runtime.h
* \defgroup pico_runtime pico_runtime
* \brief Basic runtime support for running pre-main initializers provided by other libraries
*
* This library aggregates the following other libraries (if available):
*
* * \ref hardware_uart
* * \ref pico_bit_ops
* * \ref pico_divider
* * \ref pico_double
* * \ref pico_int64_ops
* * \ref pico_float
* * \ref pico_malloc
* * \ref pico_mem_ops
* * \ref pico_atomic
* * \ref pico_cxx_options
* * \ref pico_standard_binary_info
* * \ref pico_standard_link
* * \ref pico_sync
* * \ref pico_printf
* * \ref pico_crt0
* * \ref pico_clib_interface
* * \ref pico_stdio
*/
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __ASSEMBLER__
/*! \brief Run all the initializations that are usually called by crt0.S before entering main
* \ingroup pico_runtime
*
* This method is useful to set up the runtime after performing a watchdog or powman reboot
* via scratch vector.
*/
void runtime_init(void);
void runtime_run_initializers(void);
void runtime_run_per_core_initializers(void);
#ifndef PICO_RUNTIME_INIT_FUNC
#define PICO_RUNTIME_INIT_FUNC(func, priority_string) uintptr_t __used __attribute__((section(".preinit_array." priority_string))) __pre_init_ ## func = (uintptr_t)(void (*)(void)) (func)
#endif
#else
#ifndef PICO_RUNTIME_INIT_FUNC
#define PICO_RUNTIME_INIT_FUNC(func, priority_string) __pre_init func, priority_string
#endif
#endif
#define PICO_RUNTIME_INIT_FUNC_HW(func, priority_string) PICO_RUNTIME_INIT_FUNC(func, priority_string)
#define PICO_RUNTIME_INIT_FUNC_RUNTIME(func, priority_string) PICO_RUNTIME_INIT_FUNC(func, priority_string)
// priority strings are of the form 00000->99999; we want the per core stuff all at the end, so prefix with ZZZZZ which is clearly after 99999
#define PICO_RUNTIME_INIT_FUNC_PER_CORE(func, priority_string) PICO_RUNTIME_INIT_FUNC(func, "ZZZZZ." priority_string)
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,50 @@
/*
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include "pico/runtime.h"
#include "pico/runtime_init.h"
void __weak hard_assertion_failure(void) {
panic("Hard assert");
}
static void runtime_run_initializers_from(uintptr_t *from) {
// Start and end points of the constructor list,
// defined by the linker script.
extern uintptr_t __preinit_array_end;
// Call each function in the list, based on the mask
// We have to take the address of the symbols, as __preinit_array_start *is*
// the first function value, not the address of it.
for (uintptr_t *p = from; p < &__preinit_array_end; p++) {
uintptr_t val = *p;
((void (*)(void))val)();
}
}
void runtime_run_initializers(void) {
extern uintptr_t __preinit_array_start;
runtime_run_initializers_from(&__preinit_array_start);
}
// We keep the per-core initializers in the standard __preinit_array so a standard C library
// initialization will force the core 0 initialization, however we also want to be able to find
// them after the fact so that we can run them on core 1. Per core initializers have sections
// __preinit_array.ZZZZZ.nnnnn i.e. the ZZZZZ sorts below all the standard __preinit_array.nnnnn
// values, and then we sort within the ZZZZZ.
//
// We create a dummy initializer in __preinit_array.YYYYY (between the standard initializers
// and the per core initializers), so we find the first per core initializer. Whilst we could
// have done this via an entry in the linker script, we want to preserve backwards compatibility
// with RP2040 custom linker scripts.
static void first_per_core_initializer(void) {}
PICO_RUNTIME_INIT_FUNC(first_per_core_initializer, "YYYYY");
void runtime_run_per_core_initializers(void) {
runtime_run_initializers_from(&__pre_init_first_per_core_initializer);
}