From 460ecf074d133cbe026cbddb7cf5fad1180c9831 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 28 May 2021 15:17:20 +0200 Subject: Set loop/wakeup/ostream either via .config or via app/commandline --- Makefile | 21 +++++++------------- include/object/outputstream.h | 4 ++-- src/app/blinkencat3/Makefile.inc | 2 +- src/app/bme680-max44009-logger/Makefile.inc | 2 +- src/app/ccs811test/Makefile.inc | 2 +- src/app/countertest/Makefile.inc | 2 +- src/app/datalogger/Makefile.inc | 2 +- src/app/ledblink/Makefile.inc | 2 +- src/app/loratest/Makefile.inc | 2 +- src/app/luxlog/Makefile.inc | 2 +- src/app/nrf24l01test/Makefile.inc | 2 +- src/app/sharp96test/Makefile.inc | 2 +- src/app/shell/Makefile.inc | 4 ++-- src/app/ssd1306test/Makefile.inc | 2 +- src/app/sysinfo/Makefile.inc | 2 +- src/app/timertest/Makefile.inc | 2 +- src/app/transactiontest/Makefile.inc | 2 +- src/app/waittest/Makefile.inc | 2 +- src/app/wetterstation/Makefile.inc | 2 +- src/app/ws2812b_dmap/Makefile.inc | 2 +- src/app/ws2812b_uart/Makefile.inc | 2 +- src/arch/arduino-nano/arch.cc | 16 +++++++-------- src/arch/arduino-nano/driver/counter.cc | 2 +- src/arch/atmega2560/arch.cc | 16 +++++++-------- src/arch/blinkenrocket/arch.cc | 12 ++++++------ src/arch/esp8266/arch.cc | 4 ++-- src/arch/esp8266/driver/stdin.cc | 4 ++-- src/arch/lm4f120h5qr-stellaris/arch.cc | 10 +++++----- src/arch/lm4f120h5qr-stellaris/lm4f_cpp_wrapper.c | 2 +- src/arch/msp430fr5969lp/arch.cc | 22 ++++++++++----------- src/arch/msp430fr5994lp/arch.cc | 24 +++++++++++------------ src/arch/posix/arch.cc | 8 ++++---- src/arch/stm32f446re-nucleo/arch.cc | 14 ++++++------- src/os/object/outputstream.cc | 2 +- 34 files changed, 97 insertions(+), 104 deletions(-) diff --git a/Makefile b/Makefile index acd8aef..834861d 100644 --- a/Makefile +++ b/Makefile @@ -2,12 +2,15 @@ # # SPDX-License-Identifier: BSD-2-Clause +COMMON_FLAGS = -g -Os -Wall -Wextra + # Only load .config when app/arch are not specified on commandline ifneq (${app}, ) CONFIG_app = ${app} CONFIG_arch = ${arch} else -include .config + COMMON_FLAGS += -include include/config.h endif # Make cannot include "foo"/Makefile.inc, so remove quotes from config entries @@ -16,7 +19,6 @@ app_dir = $(subst ${quote},,${CONFIG_app}) arch_dir = $(subst ${quote},,${CONFIG_arch}) INCLUDES = -Iinclude -Iinclude/arch/${arch_dir} -COMMON_FLAGS = -g -Os -Wall -Wextra CFLAGS = -std=c99 CXXFLAGS = -std=c++14 -fno-rtti -fno-threadsafe-statics -fno-exceptions @@ -349,24 +351,15 @@ ifeq (${timer_us}, 1) endif ifeq (${loop}, 1) - COMMON_FLAGS += -DWITH_LOOP -endif -ifdef CONFIG_loop - COMMON_FLAGS += -DWITH_LOOP + COMMON_FLAGS += -DCONFIG_loop endif ifeq (${wakeup}, 1) - COMMON_FLAGS += -DWITH_WAKEUP -endif -ifdef CONFIG_wakeup - COMMON_FLAGS += -DWITH_WAKEUP + COMMON_FLAGS += -DCONFIG_wakeup endif ifeq (${ostream}, 1) - COMMON_FLAGS += -DWITH_OSTREAM -endif -ifdef CONFIG_ostream - COMMON_FLAGS += -DWITH_OSTREAM + COMMON_FLAGS += -DCONFIG_ostream endif ifeq (${trace_malloc}, 1) @@ -381,7 +374,7 @@ endif default: build/system.elf include/config.h: .config - ${QUIET}awk -f script/conf2h.awk .config > include/config.h + ${QUIET}test -z "${app}" && awk -f script/conf2h.awk .config > include/config.h || : > include/config.h stack: default ${QUIET}test -n "${OBJDUMP}" diff --git a/include/object/outputstream.h b/include/object/outputstream.h index 97887e9..6d25797 100644 --- a/include/object/outputstream.h +++ b/include/object/outputstream.h @@ -7,7 +7,7 @@ #define OUTPUTSTREAM_H #include -#ifdef WITH_OSTREAM +#ifdef CONFIG_ostream #include #endif @@ -47,7 +47,7 @@ class OutputStream { OutputStream & operator<<(double number); OutputStream & operator<<(OutputStream & (*fun) (OutputStream &)); -#ifdef WITH_OSTREAM +#ifdef CONFIG_ostream OutputStream & operator<<(std::string s); #endif diff --git a/src/app/blinkencat3/Makefile.inc b/src/app/blinkencat3/Makefile.inc index 1e6ffd2..9e6fc3c 100644 --- a/src/app/blinkencat3/Makefile.inc +++ b/src/app/blinkencat3/Makefile.inc @@ -5,6 +5,6 @@ # SPDX-License-Identifier: CC0-1.0 ifdef app - CONFIG_loop = y + loop = 1 override arch_drivers += ,neopixel endif diff --git a/src/app/bme680-max44009-logger/Makefile.inc b/src/app/bme680-max44009-logger/Makefile.inc index 226bc40..e31f936 100644 --- a/src/app/bme680-max44009-logger/Makefile.inc +++ b/src/app/bme680-max44009-logger/Makefile.inc @@ -5,7 +5,7 @@ # SPDX-License-Identifier: CC0-1.0 ifdef app - CONFIG_loop = y + loop = 1 override arch_drivers += ,i2c CONFIG_driver_bme680 = y CONFIG_driver_max44009 = y diff --git a/src/app/ccs811test/Makefile.inc b/src/app/ccs811test/Makefile.inc index 933df6b..3c0ee21 100644 --- a/src/app/ccs811test/Makefile.inc +++ b/src/app/ccs811test/Makefile.inc @@ -7,5 +7,5 @@ ifdef app override arch_drivers += ,i2c CONFIG_driver_ccS811 = y - CONFIG_loop = y + loop = 1 endif diff --git a/src/app/countertest/Makefile.inc b/src/app/countertest/Makefile.inc index 836882a..905f8e0 100644 --- a/src/app/countertest/Makefile.inc +++ b/src/app/countertest/Makefile.inc @@ -5,6 +5,6 @@ # SPDX-License-Identifier: CC0-1.0 ifdef app - CONFIG_loop = y + loop = 1 override arch_drivers += ,counter endif diff --git a/src/app/datalogger/Makefile.inc b/src/app/datalogger/Makefile.inc index d2a9de5..df4e6f3 100644 --- a/src/app/datalogger/Makefile.inc +++ b/src/app/datalogger/Makefile.inc @@ -5,6 +5,6 @@ # SPDX-License-Identifier: CC0-1.0 ifdef app - CONFIG_loop = y + loop = 1 override arch_drivers += ,i2c endif diff --git a/src/app/ledblink/Makefile.inc b/src/app/ledblink/Makefile.inc index c10dce5..0eea52a 100644 --- a/src/app/ledblink/Makefile.inc +++ b/src/app/ledblink/Makefile.inc @@ -5,5 +5,5 @@ # SPDX-License-Identifier: CC0-1.0 ifdef app - CONFIG_loop = y + loop = 1 endif diff --git a/src/app/loratest/Makefile.inc b/src/app/loratest/Makefile.inc index c10dce5..0eea52a 100644 --- a/src/app/loratest/Makefile.inc +++ b/src/app/loratest/Makefile.inc @@ -5,5 +5,5 @@ # SPDX-License-Identifier: CC0-1.0 ifdef app - CONFIG_loop = y + loop = 1 endif diff --git a/src/app/luxlog/Makefile.inc b/src/app/luxlog/Makefile.inc index bb965e3..0d3e2df 100644 --- a/src/app/luxlog/Makefile.inc +++ b/src/app/luxlog/Makefile.inc @@ -5,7 +5,7 @@ # SPDX-License-Identifier: CC0-1.0 ifdef app - CONFIG_loop = y + loop = 1 override arch_drivers += ,i2c CONFIG_driver_max44009 = y endif diff --git a/src/app/nrf24l01test/Makefile.inc b/src/app/nrf24l01test/Makefile.inc index 150b887..9e58868 100644 --- a/src/app/nrf24l01test/Makefile.inc +++ b/src/app/nrf24l01test/Makefile.inc @@ -5,7 +5,7 @@ # SPDX-License-Identifier: CC0-1.0 ifdef app - CONFIG_loop = y + loop = 1 override timer_s = 1 override arch_drivers += ,spi CONFIG_driver_nrf24l01 = y diff --git a/src/app/sharp96test/Makefile.inc b/src/app/sharp96test/Makefile.inc index b0c74ef..c8ffb78 100644 --- a/src/app/sharp96test/Makefile.inc +++ b/src/app/sharp96test/Makefile.inc @@ -5,7 +5,7 @@ # SPDX-License-Identifier: CC0-1.0 ifdef app - CONFIG_loop = y + loop = 1 override arch_drivers += ,spi CONFIG_driver_sharp96 = y endif diff --git a/src/app/shell/Makefile.inc b/src/app/shell/Makefile.inc index 0cc1dcf..daadae0 100644 --- a/src/app/shell/Makefile.inc +++ b/src/app/shell/Makefile.inc @@ -5,7 +5,7 @@ # SPDX-License-Identifier: CC0-1.0 ifdef app - override undefine CONFIG_loop - CONFIG_wakeup = y + override undefine loop + wakeup = 1 override arch_drivers += ,stdin endif diff --git a/src/app/ssd1306test/Makefile.inc b/src/app/ssd1306test/Makefile.inc index 9a32d56..ebdcbd8 100644 --- a/src/app/ssd1306test/Makefile.inc +++ b/src/app/ssd1306test/Makefile.inc @@ -5,7 +5,7 @@ # SPDX-License-Identifier: CC0-1.0 ifdef app - CONFIG_loop = y + loop = 1 override arch_drivers += ,i2c CONFIG_driver_ssd1306 = y CONFIG_driver_ssd1306_width = 128 diff --git a/src/app/sysinfo/Makefile.inc b/src/app/sysinfo/Makefile.inc index c10dce5..0eea52a 100644 --- a/src/app/sysinfo/Makefile.inc +++ b/src/app/sysinfo/Makefile.inc @@ -5,5 +5,5 @@ # SPDX-License-Identifier: CC0-1.0 ifdef app - CONFIG_loop = y + loop = 1 endif diff --git a/src/app/timertest/Makefile.inc b/src/app/timertest/Makefile.inc index cf91e0c..e2fe07f 100644 --- a/src/app/timertest/Makefile.inc +++ b/src/app/timertest/Makefile.inc @@ -5,7 +5,7 @@ # SPDX-License-Identifier: CC0-1.0 ifdef app - CONFIG_loop = y + loop = 1 override timer_s = 1 override arch_drivers += ,timer endif diff --git a/src/app/transactiontest/Makefile.inc b/src/app/transactiontest/Makefile.inc index d1766bb..f7ab9e6 100644 --- a/src/app/transactiontest/Makefile.inc +++ b/src/app/transactiontest/Makefile.inc @@ -5,7 +5,7 @@ # SPDX-License-Identifier: CC0-1.0 ifdef app - CONFIG_loop = y + loop = 1 override timer_s = 1 endif diff --git a/src/app/waittest/Makefile.inc b/src/app/waittest/Makefile.inc index cf91e0c..e2fe07f 100644 --- a/src/app/waittest/Makefile.inc +++ b/src/app/waittest/Makefile.inc @@ -5,7 +5,7 @@ # SPDX-License-Identifier: CC0-1.0 ifdef app - CONFIG_loop = y + loop = 1 override timer_s = 1 override arch_drivers += ,timer endif diff --git a/src/app/wetterstation/Makefile.inc b/src/app/wetterstation/Makefile.inc index c10dce5..0eea52a 100644 --- a/src/app/wetterstation/Makefile.inc +++ b/src/app/wetterstation/Makefile.inc @@ -5,5 +5,5 @@ # SPDX-License-Identifier: CC0-1.0 ifdef app - CONFIG_loop = y + loop = 1 endif diff --git a/src/app/ws2812b_dmap/Makefile.inc b/src/app/ws2812b_dmap/Makefile.inc index 643d85e..daa2e4f 100644 --- a/src/app/ws2812b_dmap/Makefile.inc +++ b/src/app/ws2812b_dmap/Makefile.inc @@ -5,6 +5,6 @@ # SPDX-License-Identifier: CC0-1.0 ifdef app - CONFIG_loop = y + loop = 1 override arch_drivers += ,stdin,neopixel endif diff --git a/src/app/ws2812b_uart/Makefile.inc b/src/app/ws2812b_uart/Makefile.inc index 643d85e..daa2e4f 100644 --- a/src/app/ws2812b_uart/Makefile.inc +++ b/src/app/ws2812b_uart/Makefile.inc @@ -5,6 +5,6 @@ # SPDX-License-Identifier: CC0-1.0 ifdef app - CONFIG_loop = y + loop = 1 override arch_drivers += ,stdin,neopixel endif diff --git a/src/arch/arduino-nano/arch.cc b/src/arch/arduino-nano/arch.cc index 8ff93ee..5f72c06 100644 --- a/src/arch/arduino-nano/arch.cc +++ b/src/arch/arduino-nano/arch.cc @@ -43,7 +43,7 @@ void Arch::setup(void) #error Unsupported F_CPU #endif -#if defined(WITH_LOOP) || defined(TIMER_S) +#if defined(CONFIG_loop) || defined(TIMER_S) TCCR1A = 0; TCCR1B = _BV(WGM12) | _BV(CS12) | _BV(CS10); // /1024 OCR1A = F_CPU / 1024; @@ -61,17 +61,17 @@ void Arch::setup(void) sei(); } -#ifdef WITH_WAKEUP +#ifdef CONFIG_wakeup void wakeup(); #endif -#if defined(WITH_LOOP) || defined(TIMER_S) +#if defined(CONFIG_loop) || defined(TIMER_S) #include "driver/uptime.h" #endif -#if defined(WITH_LOOP) +#if defined(CONFIG_loop) extern void loop(); volatile char run_loop = 0; #endif @@ -83,13 +83,13 @@ void Arch::idle_loop(void) asm("sleep"); SMCR = 0; asm("wdr"); -#ifdef WITH_LOOP +#ifdef CONFIG_loop if (run_loop) { loop(); run_loop = 0; } #endif -#ifdef WITH_WAKEUP +#ifdef CONFIG_wakeup wakeup(); #endif } @@ -119,12 +119,12 @@ void Arch::delay_ms(unsigned int const ms) Arch arch; -#if defined(WITH_LOOP) || defined(TIMER_S) +#if defined(CONFIG_loop) || defined(TIMER_S) #ifndef __acweaving ISR(TIMER1_COMPA_vect) { -#ifdef WITH_LOOP +#ifdef CONFIG_loop run_loop = 1; #endif #ifdef TIMER_S diff --git a/src/arch/arduino-nano/driver/counter.cc b/src/arch/arduino-nano/driver/counter.cc index 0c9f8a4..842bfe8 100644 --- a/src/arch/arduino-nano/driver/counter.cc +++ b/src/arch/arduino-nano/driver/counter.cc @@ -5,7 +5,7 @@ */ #include "driver/counter.h" -#if defined(TIMER_S) || defined(WITH_LOOP) +#if defined(TIMER_S) || defined(CONFIG_loop) #warn "timer/loop and counter are mutually exclusive. Expect odd behaviour." #endif diff --git a/src/arch/atmega2560/arch.cc b/src/arch/atmega2560/arch.cc index 9d7e101..763a920 100644 --- a/src/arch/atmega2560/arch.cc +++ b/src/arch/atmega2560/arch.cc @@ -19,7 +19,7 @@ void Arch::setup(void) #error Unsupported F_CPU #endif -#if defined(WITH_LOOP) || defined(TIMER_S) +#if defined(CONFIG_loop) || defined(TIMER_S) TCCR1A = 0; TCCR1B = _BV(WGM12) | _BV(CS12) | _BV(CS10); // /1024 OCR1A = F_CPU / 1024; @@ -29,17 +29,17 @@ void Arch::setup(void) sei(); } -#ifdef WITH_WAKEUP +#ifdef CONFIG_wakeup void wakeup(); #endif -#if defined(WITH_LOOP) || defined(TIMER_S) +#if defined(CONFIG_loop) || defined(TIMER_S) #include "driver/uptime.h" #endif -#if defined(WITH_LOOP) +#if defined(CONFIG_loop) extern void loop(); volatile char run_loop = 0; #endif @@ -51,13 +51,13 @@ void Arch::idle_loop(void) asm("sleep"); SMCR = 0; asm("wdr"); -#ifdef WITH_LOOP +#ifdef CONFIG_loop if (run_loop) { loop(); run_loop = 0; } #endif -#ifdef WITH_WAKEUP +#ifdef CONFIG_wakeup wakeup(); #endif } @@ -87,12 +87,12 @@ void Arch::delay_ms(unsigned int const ms) Arch arch; -#if defined(WITH_LOOP) || defined(TIMER_S) +#if defined(CONFIG_loop) || defined(TIMER_S) #ifndef __acweaving ISR(TIMER1_COMPA_vect) { -#ifdef WITH_LOOP +#ifdef CONFIG_loop run_loop = 1; #endif #ifdef TIMER_S diff --git a/src/arch/blinkenrocket/arch.cc b/src/arch/blinkenrocket/arch.cc index ed55d5d..7f9497e 100644 --- a/src/arch/blinkenrocket/arch.cc +++ b/src/arch/blinkenrocket/arch.cc @@ -10,7 +10,7 @@ void Arch::setup(void) { -#if defined(WITH_LOOP) || defined(TIMER_S) +#if defined(CONFIG_loop) || defined(TIMER_S) TCCR1A = 0; TCCR1B = _BV(WGM12) | _BV(CS12) | _BV(CS10); // /1024 OCR1A = F_CPU / 1024; @@ -27,11 +27,11 @@ void Arch::setup(void) sei(); } -#ifdef WITH_WAKEUP +#ifdef CONFIG_wakeup void wakeup(); #endif -#if defined(WITH_LOOP) || defined(TIMER_S) +#if defined(CONFIG_loop) || defined(TIMER_S) #include "driver/uptime.h" void loop(); @@ -45,10 +45,10 @@ void Arch::idle_loop(void) asm("sleep"); SMCR = 0; asm("wdr"); -#ifdef WITH_LOOP +#ifdef CONFIG_loop loop(); #endif -#ifdef WITH_WAKEUP +#ifdef CONFIG_wakeup wakeup(); #endif #ifdef TIMER_S @@ -81,7 +81,7 @@ void Arch::delay_ms(unsigned int const ms) Arch arch; -#if defined(WITH_LOOP) || defined(TIMER_S) +#if defined(CONFIG_loop) || defined(TIMER_S) ISR(TIMER1_COMPA_vect) { diff --git a/src/arch/esp8266/arch.cc b/src/arch/esp8266/arch.cc index 1d63e67..656a700 100644 --- a/src/arch/esp8266/arch.cc +++ b/src/arch/esp8266/arch.cc @@ -22,7 +22,7 @@ extern void (*__init_array_end)(); #define user_procTaskPrio 0 #define user_procTaskQueueLen 1 -#ifdef WITH_LOOP +#ifdef CONFIG_loop LOCAL os_timer_t loop_timer; extern void loop(void); @@ -40,7 +40,7 @@ void ICACHE_FLASH_ATTR jump_to_main(void) for (void (**p)() = &__init_array_start; p != &__init_array_start; p++) { (*p)(); } -#ifdef WITH_LOOP +#ifdef CONFIG_loop os_timer_disarm(&loop_timer); os_timer_setfn(&loop_timer, (os_timer_func_t *)jump_to_loop, (void *)0); os_timer_arm(&loop_timer, 1000, 1); diff --git a/src/arch/esp8266/driver/stdin.cc b/src/arch/esp8266/driver/stdin.cc index bbb3be0..7032d81 100644 --- a/src/arch/esp8266/driver/stdin.cc +++ b/src/arch/esp8266/driver/stdin.cc @@ -38,7 +38,7 @@ void ets_isr_unmask(uint16_t idx); #define UCTOE 31 -#ifdef WITH_WAKEUP +#ifdef CONFIG_wakeup void wakeup(); #endif @@ -50,7 +50,7 @@ void uart_isr() } } USIC = USIS; -#ifdef WITH_WAKEUP +#ifdef CONFIG_wakeup wakeup(); #endif } diff --git a/src/arch/lm4f120h5qr-stellaris/arch.cc b/src/arch/lm4f120h5qr-stellaris/arch.cc index c87af2f..e613e42 100644 --- a/src/arch/lm4f120h5qr-stellaris/arch.cc +++ b/src/arch/lm4f120h5qr-stellaris/arch.cc @@ -20,16 +20,16 @@ extern "C" { void Arch::setup(void) { arch_clock_init(); -#if defined(WITH_LOOP) +#if defined(CONFIG_loop) arch_init_loop(); #endif } -#ifdef WITH_WAKEUP +#ifdef CONFIG_wakeup extern void wakeup(); #endif -#if defined(WITH_LOOP) +#if defined(CONFIG_loop) extern void loop(); extern volatile char run_loop; #endif @@ -56,7 +56,7 @@ void Arch::idle_loop(void) { while (1) { __asm__("wfi"); -#ifdef WITH_LOOP +#ifdef CONFIG_loop if (run_loop) { #ifdef TIMER_S uptime.tick_s(); @@ -71,7 +71,7 @@ void Arch::idle_loop(void) void Arch::idle(void) { __asm__("wfi"); -#ifdef WITH_WAKEUP +#ifdef CONFIG_wakeup wakeup(); #endif } diff --git a/src/arch/lm4f120h5qr-stellaris/lm4f_cpp_wrapper.c b/src/arch/lm4f120h5qr-stellaris/lm4f_cpp_wrapper.c index 62f1c20..877316f 100644 --- a/src/arch/lm4f120h5qr-stellaris/lm4f_cpp_wrapper.c +++ b/src/arch/lm4f120h5qr-stellaris/lm4f_cpp_wrapper.c @@ -17,7 +17,7 @@ void arch_clock_init() rcc_sysclk_config(OSCSRC_MOSC, XTAL_16M, 5); } -#ifdef WITH_LOOP +#ifdef CONFIG_loop volatile char run_loop = 1; void arch_init_loop() diff --git a/src/arch/msp430fr5969lp/arch.cc b/src/arch/msp430fr5969lp/arch.cc index df27f33..a9e1a57 100644 --- a/src/arch/msp430fr5969lp/arch.cc +++ b/src/arch/msp430fr5969lp/arch.cc @@ -46,7 +46,7 @@ void Arch::setup(void) #error Unsupported F_CPU #endif -#ifdef WITH_LOOP +#ifdef CONFIG_loop CSCTL2 = SELA__LFXTCLK | SELS__DCOCLK | SELM__DCOCLK; #else CSCTL2 = SELA__VLOCLK | SELS__DCOCLK | SELM__DCOCLK; @@ -55,7 +55,7 @@ void Arch::setup(void) CSCTL0_H = 0; -#ifdef WITH_LOOP +#ifdef CONFIG_loop // enable LXFT for RTC CSCTL0_H = CSKEY >> 8; CSCTL4 &= ~LFXTOFF; @@ -87,7 +87,7 @@ void Arch::setup(void) TA0CTL |= TACLR; #endif /* TIMER_US */ -#if defined(WITH_LOOP) || defined(TIMER_S) +#if defined(CONFIG_loop) || defined(TIMER_S) // 1s per wakeup for loop. Independent of SMCLK/F_CPU TA1CTL = TASSEL__ACLK | ID__8 | MC__UP; TA1EX0 = 0; @@ -96,11 +96,11 @@ void Arch::setup(void) #endif } -#ifdef WITH_WAKEUP +#ifdef CONFIG_wakeup extern void wakeup(); #endif -#if defined(WITH_LOOP) +#if defined(CONFIG_loop) extern void loop(); volatile char run_loop = 0; #endif @@ -171,13 +171,13 @@ void Arch::idle_loop(void) __bis_SR_register(GIE | LPM2_bits); asm volatile("nop"); __dint(); -#if defined(WITH_LOOP) +#if defined(CONFIG_loop) if (run_loop) { loop(); run_loop = 0; } #endif -#ifdef WITH_WAKEUP +#ifdef CONFIG_wakeup wakeup(); #endif } @@ -189,14 +189,14 @@ void Arch::idle(void) __bis_SR_register(GIE | LPM2_bits); asm volatile("nop"); __dint(); -#ifdef WITH_WAKEUP +#ifdef CONFIG_wakeup wakeup(); #endif } Arch arch; -#if defined(WITH_LOOP) || defined(TIMER_S) +#if defined(CONFIG_loop) || defined(TIMER_S) #include "driver/uptime.h" @@ -205,7 +205,7 @@ Arch arch; __attribute__((interrupt(TIMER1_A1_VECTOR))) __attribute__((wakeup)) void handle_timer1_overflow() { if (TA1IV == 0x0e) { -#ifdef WITH_LOOP +#ifdef CONFIG_loop run_loop = 1; #endif #ifdef TIMER_S @@ -215,7 +215,7 @@ __attribute__((interrupt(TIMER1_A1_VECTOR))) __attribute__((wakeup)) void handle } #endif -#endif /* defined(WITH_LOOP) || defined(TIMER_S) */ +#endif /* defined(CONFIG_loop) || defined(TIMER_S) */ #ifndef __acweaving // CCR0 interrupts are exclusive to A0 diff --git a/src/arch/msp430fr5994lp/arch.cc b/src/arch/msp430fr5994lp/arch.cc index d3d99ae..b79b8b0 100644 --- a/src/arch/msp430fr5994lp/arch.cc +++ b/src/arch/msp430fr5994lp/arch.cc @@ -48,7 +48,7 @@ void Arch::setup(void) #error Unsupported F_CPU #endif -#ifdef WITH_LOOP +#ifdef CONFIG_loop CSCTL2 = SELA__LFXTCLK | SELS__DCOCLK | SELM__DCOCLK; #else CSCTL2 = SELA__VLOCLK | SELS__DCOCLK | SELM__DCOCLK; @@ -57,7 +57,7 @@ void Arch::setup(void) CSCTL0_H = 0; -#if defined(WITH_LOOP) || F_CPU == 32768UL +#if defined(CONFIG_loop) || F_CPU == 32768UL // enable LXFT for RTC CSCTL0_H = CSKEY >> 8; CSCTL4 &= ~LFXTOFF; @@ -100,7 +100,7 @@ void Arch::setup(void) #endif // SELA__LFXTCLK falls back to VLOCLK if LFXT is not available, but set // LFXT_FAULT (LFXTOFFG) in the process. We don't want that. -#if defined(WITH_LOOP) || F_CPU == 32768UL +#if defined(CONFIG_loop) || F_CPU == 32768UL CSCTL2 = SELA__LFXTCLK | SELS__HFXTCLK | SELM__HFXTCLK; #else CSCTL2 = SELA__VLOCLK | SELS__HFXTCLK | SELM__HFXTCLK; @@ -133,7 +133,7 @@ void Arch::setup(void) CSCTL0_H = 0; #endif -#if defined(WITH_LOOP) || defined(TIMER_S) +#if defined(CONFIG_loop) || defined(TIMER_S) // 1s per wakeup for loop. Independent of SMCLK/F_CPU TA1CTL = TASSEL__ACLK | ID__8 | MC__UP; TA1EX0 = 0; @@ -142,11 +142,11 @@ void Arch::setup(void) #endif } -#ifdef WITH_WAKEUP +#ifdef CONFIG_wakeup extern void wakeup(); #endif -#if defined(WITH_LOOP) +#if defined(CONFIG_loop) extern void loop(); volatile char run_loop = 0; #endif @@ -231,13 +231,13 @@ void Arch::idle_loop(void) __bis_SR_register(GIE | LPM2_bits); asm volatile("nop"); __dint(); -#if defined(WITH_LOOP) +#if defined(CONFIG_loop) if (run_loop) { loop(); run_loop = 0; } #endif -#ifdef WITH_WAKEUP +#ifdef CONFIG_wakeup wakeup(); #endif } @@ -249,14 +249,14 @@ void Arch::idle(void) __bis_SR_register(GIE | LPM2_bits); asm volatile("nop"); __dint(); -#ifdef WITH_WAKEUP +#ifdef CONFIG_wakeup wakeup(); #endif } Arch arch; -#if defined(WITH_LOOP) || defined(TIMER_S) +#if defined(CONFIG_loop) || defined(TIMER_S) #include "driver/uptime.h" @@ -265,7 +265,7 @@ Arch arch; __attribute__((interrupt(TIMER1_A1_VECTOR))) __attribute__((wakeup)) void handle_timer1_overflow() { if (TA1IV == 0x0e) { -#ifdef WITH_LOOP +#ifdef CONFIG_loop run_loop = 1; #endif #ifdef TIMER_S @@ -275,7 +275,7 @@ __attribute__((interrupt(TIMER1_A1_VECTOR))) __attribute__((wakeup)) void handle } #endif -#endif /* defined(WITH_LOOP) || defined(TIMER_S) */ +#endif /* defined(CONFIG_loop) || defined(TIMER_S) */ #ifndef __acweaving // CCR0 interrupts are exclusive to A0 diff --git a/src/arch/posix/arch.cc b/src/arch/posix/arch.cc index 83bf845..69dfeac 100644 --- a/src/arch/posix/arch.cc +++ b/src/arch/posix/arch.cc @@ -7,11 +7,11 @@ #include #include -#if defined(WITH_LOOP) || defined(TIMER_S) +#if defined(CONFIG_loop) || defined(TIMER_S) #include "driver/uptime.h" void loop(); #endif -#ifdef WITH_WAKEUP +#ifdef CONFIG_wakeup void wakeup(); #endif @@ -21,10 +21,10 @@ void Arch::idle_loop(void) { while (1) { sleep(1); -#ifdef WITH_LOOP +#ifdef CONFIG_loop loop(); #endif -#ifdef WITH_WAKEUP +#ifdef CONFIG_wakeup wakeup(); #endif #ifdef TIMER_S diff --git a/src/arch/stm32f446re-nucleo/arch.cc b/src/arch/stm32f446re-nucleo/arch.cc index 6216843..c7566b6 100644 --- a/src/arch/stm32f446re-nucleo/arch.cc +++ b/src/arch/stm32f446re-nucleo/arch.cc @@ -39,7 +39,7 @@ void Arch::setup(void) timer_set_period(TIM2, 4294967295); timer_enable_irq(TIM2, TIM_DIER_UIE); -#ifdef WITH_LOOP +#ifdef CONFIG_loop rcc_periph_clock_enable(RCC_TIM3); nvic_enable_irq(NVIC_TIM3_IRQ); rcc_periph_reset_pulse(RST_TIM3); @@ -59,11 +59,11 @@ void Arch::setup(void) #endif } -#ifdef WITH_WAKEUP +#ifdef CONFIG_wakeup extern void wakeup(); #endif -#if defined(WITH_LOOP) +#if defined(CONFIG_loop) extern void loop(); volatile char run_loop = 0; #endif @@ -91,7 +91,7 @@ void Arch::idle_loop(void) while (1) { pwr_set_standby_mode(); __asm__("wfi"); -#ifdef WITH_LOOP +#ifdef CONFIG_loop if (run_loop) { loop(); run_loop = 0; @@ -102,14 +102,14 @@ void Arch::idle_loop(void) void Arch::idle(void) { -#ifdef WITH_WAKEUP +#ifdef CONFIG_wakeup wakeup(); #endif } Arch arch; -#if defined(WITH_LOOP) || defined(TIMER_S) +#if defined(CONFIG_loop) || defined(TIMER_S) #include "driver/uptime.h" @@ -117,7 +117,7 @@ void tim3_isr(void) { if (timer_get_flag(TIM3, TIM_SR_UIF)) { timer_clear_flag(TIM3, TIM_SR_UIF); -#ifdef WITH_LOOP +#ifdef CONFIG_loop run_loop = 1; #endif #ifdef TIMER_S diff --git a/src/os/object/outputstream.cc b/src/os/object/outputstream.cc index 33fed70..3960a3e 100644 --- a/src/os/object/outputstream.cc +++ b/src/os/object/outputstream.cc @@ -145,7 +145,7 @@ OutputStream & OutputStream::operator<<(OutputStream & (*fkt) (OutputStream &)) return fkt(*this); } -#ifdef WITH_OSTREAM +#ifdef CONFIG_ostream OutputStream & OutputStream::operator<<(std::string s) { for (auto c : s) { -- cgit v1.2.3