Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
18459: makefiles/suit: make it possible to accept multiple SUIT keys r=miri64 a=benpicco



18724: nanocoap_sock: implement DTLS socket r=miri64 a=benpicco



19081: sys/stdio_udp: add stdio over UDP r=benpicco a=benpicco



19082: core/init: add early_init() r=benpicco a=benpicco



19136: CI: re-add "synchronize" event to check-labels r=miri64 a=kaspar030



Co-authored-by: Benjamin Valentin <[email protected]>
Co-authored-by: Benjamin Valentin <[email protected]>
Co-authored-by: Kaspar Schleiser <[email protected]>
  • Loading branch information
4 people authored Jan 13, 2023
6 parents 89ef35f + 2a3c8bf + 4f57628 + 81625fd + 59f0671 + ce54329 commit fb603f2
Show file tree
Hide file tree
Showing 73 changed files with 838 additions and 145 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check-labels.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: check-labels
on:
pull_request:
types: [opened, reopened, labeled, unlabeled]
types: [opened, reopened, labeled, unlabeled, synchronize]
pull_request_review:
types: [submitted, dismissed]
jobs:
Expand Down
9 changes: 9 additions & 0 deletions core/lib/include/kernel_init.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@ void kernel_init(void);
*/
void board_init(void);

/**
* @brief Initialize debug LEDs and stdio
*/
#ifdef MODULE_CORE_INIT
void early_init(void);
#else
static inline void early_init(void) {}
#endif

#ifdef __cplusplus
}
#endif
Expand Down
20 changes: 20 additions & 0 deletions core/lib/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@
#include "log.h"
#include "periph/pm.h"
#include "thread.h"
#include "stdio_base.h"

#if IS_USED(MODULE_VFS)
#include "vfs.h"
#endif

#define ENABLE_DEBUG 0
#include "debug.h"
Expand Down Expand Up @@ -102,3 +107,18 @@ void kernel_init(void)

cpu_switch_context_exit();
}

void early_init(void)
{
/* initialize leds */
if (IS_USED(MODULE_PERIPH_INIT_LEDS)) {
extern void led_init(void);
led_init();
}

stdio_init();

#if MODULE_VFS
vfs_bind_stdio();
#endif
}
3 changes: 2 additions & 1 deletion cpu/avr8_common/avr_libc_extra/avr8_stdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <stdio.h>
#include <avr/io.h>

#include "kernel_init.h"
#include "stdio_uart.h"

static int _uart_putchar(char c, FILE *stream);
Expand All @@ -45,7 +46,7 @@ static int _uart_getchar(FILE *stream)

void avr8_stdio_init(void)
{
stdio_init();
early_init();

stdout = &_uart_stdout;
stdin = &_uart_stdin;
Expand Down
3 changes: 2 additions & 1 deletion cpu/cc2538/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "stdio_base.h"

#include "cpu.h"
#include "kernel_init.h"
#include "periph/init.h"
#include "periph_conf.h"

Expand All @@ -37,7 +38,7 @@ void cpu_init(void)
/* initialize the clock system */
cpu_clock_init();
/* initialize stdio prior to periph_init() to allow use of DEBUG() there */
stdio_init();
early_init();
/* trigger static peripheral initialization */
periph_init();
}
Expand Down
3 changes: 2 additions & 1 deletion cpu/cc26x0_cc13x0/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/

#include "cpu.h"
#include "kernel_init.h"
#include "periph_conf.h"
#include "periph/init.h"
#include "stdio_base.h"
Expand Down Expand Up @@ -46,7 +47,7 @@ void cpu_init(void)
#endif

/* initialize stdio prior to periph_init() to allow use of DEBUG() there */
stdio_init();
early_init();

/* trigger static peripheral initialization */
periph_init();
Expand Down
3 changes: 2 additions & 1 deletion cpu/cc26x2_cc13x2/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*/

#include "cpu.h"
#include "kernel_init.h"
#include "periph_conf.h"
#include "periph/init.h"
#include "stdio_base.h"
Expand All @@ -37,7 +38,7 @@ void cpu_init(void)
setup_trim_device();

/* initialize stdio prior to periph_init() to allow use of DEBUG() there */
stdio_init();
early_init();

/* trigger static peripheral initialization */
periph_init();
Expand Down
3 changes: 2 additions & 1 deletion cpu/efm32/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
*/

#include "cpu.h"
#include "kernel_init.h"
#include "periph_conf.h"
#include "periph/init.h"
#include "stdio_base.h"
Expand Down Expand Up @@ -231,7 +232,7 @@ void cpu_init(void)
pm_init();

/* initialize stdio prior to periph_init() to allow use of DEBUG() there */
stdio_init();
early_init();

/* trigger static peripheral initialization */
periph_init();
Expand Down
15 changes: 15 additions & 0 deletions cpu/esp32/doc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,21 @@
* directory for more details.
*/

/**
* @defgroup stdio_usb_serial_jtag STDIO over ESP32 Debug Serial/JTAG
* @ingroup sys_stdio
* @brief STDIO via the USB Serial/JTAG debug interface found on some ESP32 SoCs
*
* Some members of the ESP32 family (ESP32-C3, ESP32-S3, ESP32-H2) provide a on-chip
* debug interface that provides a serial console and JTAG via USB.
*
* To route STDIO to this debug console, enable this module.
*
* USEMODULE += stdio_usb_serial_jtag
*
* @see cpu_esp32
*/

/**
@defgroup cpu_esp32 ESP32 SoC Series
@ingroup cpu
Expand Down
2 changes: 1 addition & 1 deletion cpu/esp32/startup.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ static NORETURN void IRAM system_startup_cpu0(void)

/* initialize stdio */
esp_rom_uart_tx_wait_idle(CONFIG_ESP_CONSOLE_UART_NUM);
stdio_init();
early_init();

RESET_REASON reset_reason = rtc_get_reset_reason(PRO_CPU_NUM);

Expand Down
2 changes: 1 addition & 1 deletion cpu/esp8266/startup.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ void esp_riot_init(void)

/* initialize stdio*/
extern int stdio_is_initialized;
stdio_init();
early_init();
stdio_is_initialized = 1;

/* trigger static peripheral initialization */
Expand Down
3 changes: 2 additions & 1 deletion cpu/fe310/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

#include "clk.h"
#include "cpu.h"
#include "kernel_init.h"
#include "periph/init.h"
#include "periph_conf.h"

Expand Down Expand Up @@ -108,7 +109,7 @@ void cpu_init(void)
riscv_init();

/* Initialize stdio */
stdio_init();
early_init();

/* Initialize static peripheral */
periph_init();
Expand Down
3 changes: 2 additions & 1 deletion cpu/gd32v/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
*
* @author Koen Zandberg <[email protected]>
*/
#include "kernel_init.h"
#include "stdio_uart.h"
#include "periph/init.h"
#include "irq_arch.h"
Expand All @@ -30,6 +31,6 @@ void cpu_init(void)
gd32vf103_clock_init();
/* Common RISC-V initialization */
riscv_init();
stdio_init();
early_init();
periph_init();
}
3 changes: 2 additions & 1 deletion cpu/kinetis/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/

#include "cpu.h"
#include "kernel_init.h"
#include "periph/init.h"
#include "stdio_base.h"
#ifdef MODULE_PERIPH_MCG
Expand All @@ -44,7 +45,7 @@ void cpu_init(void)
#endif

/* initialize stdio prior to periph_init() to allow use of DEBUG() there */
stdio_init();
early_init();

/* trigger static peripheral initialization */
periph_init();
Expand Down
3 changes: 2 additions & 1 deletion cpu/lm4f120/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/

#include "cpu.h"
#include "kernel_init.h"
#include "irq.h"
#include "sched.h"
#include "thread.h"
Expand All @@ -38,7 +39,7 @@ void cpu_init(void)
cpu_clock_init(CLOCK_SOURCE);

/* initialize stdio prior to periph_init() to allow use of DEBUG() there */
stdio_init();
early_init();

/* trigger static peripheral initialization */
periph_init();
Expand Down
3 changes: 2 additions & 1 deletion cpu/lpc1768/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/

#include "cpu.h"
#include "kernel_init.h"
#include "periph/init.h"
#include "stdio_base.h"

Expand All @@ -29,7 +30,7 @@ void cpu_init(void)
/* initialize the Cortex-M core */
cortexm_init();
/* initialize stdio prior to periph_init() to allow use of DEBUG() there */
stdio_init();
early_init();
/* trigger static peripheral initialization */
periph_init();
}
3 changes: 2 additions & 1 deletion cpu/lpc23xx/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

#include <stdint.h>
#include "cpu.h"
#include "kernel_init.h"
#include "irq.h"
#include "VIC.h"

Expand Down Expand Up @@ -130,7 +131,7 @@ void cpu_init(void)
board_init();

/* initialize stdio prior to periph_init() to allow use of DEBUG() there */
stdio_init();
early_init();

/* trigger static peripheral initialization */
periph_init();
Expand Down
1 change: 1 addition & 0 deletions cpu/msp430_common/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/

#include "cpu.h"
#include "kernel_init.h"
#include "irq.h"
#include "sched.h"
#include "thread.h"
Expand Down
2 changes: 1 addition & 1 deletion cpu/msp430_common/startup.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ __attribute__((constructor)) static void startup(void)
#endif

/* initialize stdio prior to periph_init() to allow use of DEBUG() there */
stdio_init();
early_init();
/* trigger static peripheral initialization */
periph_init();
/* continue with kernel initialization */
Expand Down
11 changes: 11 additions & 0 deletions cpu/native/include/native_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,17 @@
* Native CPU internal declarations
*/

/**
* @defgroup cpu_native_stdio STDIO for native
* @ingroup sys_stdio
* @brief Standard input/output backend for native
*
* This will hook up RIOT's stdio to the host's stdio fds. It is the default
* stdio implementation of the board `native`.
*
* @see cpu_native
*/

/**
* @ingroup cpu_native
* @{
Expand Down
2 changes: 1 addition & 1 deletion cpu/native/startup.c
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ __attribute__((constructor)) static void startup(int argc, char **argv, char **e
{
_native_init_syscalls();
/* initialize stdio as early as possible */
stdio_init();
early_init();

_native_argv = argv;
_progname = argv[0];
Expand Down
4 changes: 0 additions & 4 deletions cpu/native/stdio_native/stdio_native.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,11 @@

#include "kernel_defines.h"
#include "native_internal.h"
#include "vfs.h"

#include "stdio_base.h"

void stdio_init(void)
{
if (IS_USED(MODULE_VFS)) {
vfs_bind_stdio();
}
}

ssize_t stdio_read(void* buffer, size_t max_len)
Expand Down
3 changes: 2 additions & 1 deletion cpu/nrf51/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/

#include "cpu.h"
#include "kernel_init.h"
#include "nrf_clock.h"
#include "nrfx_riot.h"
#include "periph_conf.h"
Expand All @@ -36,7 +37,7 @@ void cpu_init(void)
/* setup the HF clock */
clock_init_hf();
/* initialize stdio prior to periph_init() to allow use of DEBUG() there */
stdio_init();
early_init();
/* trigger static peripheral initialization */
periph_init();
}
3 changes: 2 additions & 1 deletion cpu/nrf52/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#define DONT_OVERRIDE_NVIC

#include "cpu.h"
#include "kernel_init.h"
#include "nrfx_riot.h"
#include "nrf_clock.h"
#include "periph_conf.h"
Expand Down Expand Up @@ -75,7 +76,7 @@ void cpu_init(void)
SCB->SCR |= SCB_SCR_SEVONPEND_Msk;

/* initialize stdio prior to periph_init() to allow use of DEBUG() there */
stdio_init();
early_init();

/* trigger static peripheral initialization */
periph_init();
Expand Down
3 changes: 2 additions & 1 deletion cpu/nrf9160/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*/

#include "cpu.h"
#include "kernel_init.h"
#include "nrf_clock.h"
#include "periph_conf.h"
#include "periph/init.h"
Expand All @@ -44,7 +45,7 @@ void cpu_init(void)
SCB->SCR |= SCB_SCR_SEVONPEND_Msk;

/* initialize stdio prior to periph_init() to allow use of DEBUG() there */
stdio_init();
early_init();

/* trigger static peripheral initialization */
periph_init();
Expand Down
Loading

0 comments on commit fb603f2

Please sign in to comment.