From 3cdc9ae0ca4ac854be2fd480909e210a40cf2f88 Mon Sep 17 00:00:00 2001 From: Toby Jaffey Date: Tue, 9 Dec 2025 01:19:09 +0000 Subject: [PATCH] Default behaviour is to run to end of main --- apps/conio/conio.c | 1 - apps/fib/fib.c | 1 - apps/helloworld/helloworld.c | 1 - apps/lissajous/lissajous.c | 1 - apps/self/self.c | 2 -- apps/sketch/sketch.c | 12 ++++++++++++ common/uvm32_target.h | 13 ------------- 7 files changed, 12 insertions(+), 19 deletions(-) diff --git a/apps/conio/conio.c b/apps/conio/conio.c index bdeaecd..d2ae239 100644 --- a/apps/conio/conio.c +++ b/apps/conio/conio.c @@ -1,4 +1,3 @@ -#define USE_MAIN #include "uvm32_target.h" void main(void) { diff --git a/apps/fib/fib.c b/apps/fib/fib.c index 1df3da0..238490b 100644 --- a/apps/fib/fib.c +++ b/apps/fib/fib.c @@ -1,4 +1,3 @@ -#define USE_MAIN #include "uvm32_target.h" void write(int n) { diff --git a/apps/helloworld/helloworld.c b/apps/helloworld/helloworld.c index 13ccbf4..91ec45e 100644 --- a/apps/helloworld/helloworld.c +++ b/apps/helloworld/helloworld.c @@ -1,4 +1,3 @@ -#define USE_MAIN #include "uvm32_target.h" void main(void) { diff --git a/apps/lissajous/lissajous.c b/apps/lissajous/lissajous.c index d678a4c..8aa19bb 100644 --- a/apps/lissajous/lissajous.c +++ b/apps/lissajous/lissajous.c @@ -1,4 +1,3 @@ -#define USE_MAIN #include "uvm32_target.h" // https://github.com/shastro/CodeGolf-Lissajous/blob/master/lissa.c diff --git a/apps/self/self.c b/apps/self/self.c index 72b36fa..ee309e5 100644 --- a/apps/self/self.c +++ b/apps/self/self.c @@ -1,6 +1,4 @@ -#define USE_MAIN #include "uvm32_target.h" - #include "uvm32.h" #include "../common/uvm32_common_custom.h" diff --git a/apps/sketch/sketch.c b/apps/sketch/sketch.c index 94c92f5..0148e53 100644 --- a/apps/sketch/sketch.c +++ b/apps/sketch/sketch.c @@ -1,5 +1,10 @@ #include "uvm32_target.h" +// provide main, with setup()/loop() flow +void setup(void); +bool loop(void); + + uint32_t count; bool loop(void) { @@ -16,3 +21,10 @@ void setup(void) { } +void main(void) { + setup(); + while(loop()) { + yield(); + } +} + diff --git a/common/uvm32_target.h b/common/uvm32_target.h index 7b1ec8a..276a8e5 100644 --- a/common/uvm32_target.h +++ b/common/uvm32_target.h @@ -59,16 +59,3 @@ static uint32_t syscall(uint32_t id, uint32_t param) { #include "uvm32_common_custom.h" -// provide main, with setup()/loop() flow -void setup(void); -bool loop(void); - -#ifndef USE_MAIN -void main(void) { - setup(); - while(loop()) { - yield(); - } -} -#endif -