Skip to content
This repository was archived by the owner on May 3, 2026. It is now read-only.

Commit 7499f08

Browse files
committed
remove system daemon
1 parent 6ca34b4 commit 7499f08

8 files changed

Lines changed: 28 additions & 268 deletions

File tree

include/system/user_functions.h

Lines changed: 0 additions & 5 deletions
This file was deleted.

include/system/user_functions/c_list.h

Lines changed: 0 additions & 9 deletions
This file was deleted.

include/system/user_functions/cpp_list.h

Lines changed: 0 additions & 9 deletions
This file was deleted.

include/system/user_functions/list.h

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/system/startup.cpp

Lines changed: 25 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
1414
*/
1515

16+
#include "pros/rtos.hpp"
1617
#include "v5_api_patched.h"
1718

1819
#include <cstdint>
@@ -21,56 +22,37 @@
2122
#include <sys/unistd.h>
2223

2324
extern "C" {
24-
2525
// Initialization routines provided elsewhere
2626
void rtos_initialize();
2727
void vfs_initialize();
28-
29-
[[gnu::weak]]
30-
void display_initialize() {}
31-
3228
void rtos_sched_start();
33-
34-
// libc initialization
3529
void __libc_init_array();
36-
37-
// tick vex tasks
38-
void vexTasksRun();
39-
} // extern "C"
40-
41-
void system_daemon_initialize();
30+
}
4231

4332
// this goes in the first 32-byte chunk of the user program
4433
// which is why the entrypoint is offset from 0x3800000 by 0x20
4534
// only the first 16 bytes of this chunk is used however
4635
// see the vcodesig definition in the SDK for more details
4736
[[gnu::section(".boot_data")]]
48-
vcodesig vexCodeSig = {V5_SIG_MAGIC, V5_SIG_TYPE_USER, V5_SIG_OWNER_PARTNER, V5_SIG_OPTIONS_NONE};
37+
vcodesig vexCodeSig = {
38+
.magic = V5_SIG_MAGIC,
39+
.type = V5_SIG_TYPE_USER,
40+
.owner = V5_SIG_OWNER_PARTNER,
41+
.options = V5_SIG_OPTIONS_NONE,
42+
};
4943

5044
// The pros_init function is executed early (via constructor attribute)
51-
// before most global C++ constructors are run.
52-
[[gnu::constructor(102)]]
45+
[[gnu::constructor(101)]]
5346
static void pros_init() {
5447
rtos_initialize();
5548
vfs_initialize();
56-
display_initialize();
57-
// Note: system_daemon_initialize must be called last, per design requirements.
58-
system_daemon_initialize();
5949
}
6050

61-
// the main function, starts the scheduler and ensures the program exits gracefully if it fails
62-
int main() {
63-
// Start freeRTOS
64-
rtos_sched_start();
51+
// forward-declare main function
52+
int main();
6553

66-
// If execution reaches here, the scheduler has failed.
67-
vexDisplayPrintf(10, 60, 1, "failed to start scheduler\n");
68-
std::printf("Failed to start Scheduler\n");
69-
_exit(0); // exit with code 0 to stop spinlock
70-
}
71-
72-
// program entrypoint. This is the first function that is run
73-
// it sets up memory, calls constructors, and then calls main
54+
// Program entrypoint. This is the first function that is run.
55+
// It sets up memory, calls constructors, and starts the scheduler
7456
extern "C" [[gnu::section(".boot")]]
7557
void _start() {
7658
// Symbols provided by the linker script
@@ -89,15 +71,23 @@ void _start() {
8971
// call global constructors
9072
__libc_init_array();
9173

92-
// call the main function
93-
// This GCC warning is a nuisance.
94-
// This is the industry standard
74+
// start main task
75+
// these pragmas are needed to silence the same warning on clang and gcc
76+
// normally you aren't supposed to reference the main function
9577
#pragma GCC diagnostic push
9678
#pragma GCC diagnostic ignored "-Wpedantic"
9779
#pragma GCC diagnostic ignored "-Wunknown-pragmas"
9880
#pragma clang diagnostic push
9981
#pragma clang diagnostic ignored "-Wmain"
100-
main();
82+
pros::Task task(main);
10183
#pragma clang diagnostic pop
10284
#pragma GCC diagnostic pop
85+
86+
// start the scheduler
87+
rtos_sched_start();
88+
89+
// If execution reaches here, the scheduler has failed.
90+
vexDisplayPrintf(10, 60, 1, "failed to start scheduler\n");
91+
std::printf("Failed to start Scheduler\n");
92+
_exit(0); // exit with code 0 to stop spinlock
10393
}

src/system/system_daemon.cpp

Lines changed: 0 additions & 160 deletions
This file was deleted.

src/system/user_functions.cpp

Lines changed: 0 additions & 40 deletions
This file was deleted.

tests/examples/basic.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
#include "main.h"
1+
#include "v5_api_patched.h"
22

3-
void initialize() {
4-
pros::delay(3000);
5-
std::cout << "hello world!" << std::endl;
3+
int main() {
4+
vexDisplayPrintf(10, 60, 1, "Hello World!\n");
65
}

0 commit comments

Comments
 (0)