File tree 4 files changed +71
-75
lines changed
nucleo_u575zi-q/fiber_overflow
4 files changed +71
-75
lines changed Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright (c) 2024, Niklas Hauser
3
+ *
4
+ * This file is part of the modm project.
5
+ *
6
+ * This Source Code Form is subject to the terms of the Mozilla Public
7
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
8
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9
+ */
10
+ // ----------------------------------------------------------------------------
11
+
12
+ #include < modm/board.hpp>
13
+ #include < modm/processing.hpp>
14
+
15
+ using namespace Board ;
16
+ using namespace std ::chrono_literals;
17
+
18
+
19
+ bool overflow{false };
20
+
21
+ modm::Fiber<> bad_fiber ([]
22
+ {
23
+ while (1 )
24
+ {
25
+ #ifdef __AVR__
26
+ if (overflow) asm volatile (" push r1" );
27
+ #else
28
+ if (overflow) asm volatile (" push {r0-r7}" );
29
+ #endif
30
+ modm::this_fiber::yield ();
31
+ }
32
+ });
33
+
34
+ modm::Fiber<> blinky ([]
35
+ {
36
+ while (1 )
37
+ {
38
+ Board::Leds::toggle ();
39
+ modm::this_fiber::sleep_for (0 .5s);
40
+ char c;
41
+ modm::log ::info.get (c);
42
+ if (c == ' o' ) overflow = true ;
43
+ }
44
+ });
45
+
46
+ int
47
+ main ()
48
+ {
49
+ Board::initialize ();
50
+ Board::Leds::setOutput ();
51
+ MODM_LOG_INFO << " \n Reboot!\n Send 'o' to overflow the stack!" << modm::endl;
52
+ modm::delay (1s);
53
+
54
+ modm::fiber::Scheduler::run ();
55
+
56
+ return 0 ;
57
+ }
Original file line number Diff line number Diff line change
1
+ <library >
2
+ <extends >modm:nucleo-u575zi-q</extends >
3
+ <!-- <extends>modm:nucleo-g071rb</extends> -->
4
+ <!-- <extends>modm:nucleo-l476rg</extends> -->
5
+ <!-- <extends>modm:mega-2560-pro</extends> -->
6
+ <!-- <extends>modm:arduino-uno</extends> -->
7
+ <options >
8
+ <option name =" modm:build:build.path" >../../../build/generic/fiber_overflow</option >
9
+ </options >
10
+ <modules >
11
+ <module >modm:build:scons</module >
12
+ <module >modm:processing:fiber</module >
13
+ </modules >
14
+ </library >
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments