Skip to content

Commit 9dcee40

Browse files
committed
[rtt] Refactor to use the SEGGER RTT implementation
1 parent 3ed2fdb commit 9dcee40

File tree

22 files changed

+192
-414
lines changed

22 files changed

+192
-414
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ git clone --recurse-submodules --jobs 8 https://github.com/modm-io/modm.git
7777
- [printf][]: Small printf implementation.
7878
- [Nanopb][]: Embedded Protocol Buffers.
7979
- [LVGL][]: Embedded Graphics Library.
80+
- [RTT][]: Segger Real-Time Transport.
8081

8182

8283
## Microcontrollers
@@ -972,4 +973,5 @@ and [many more contributors][contributors].
972973
[printf]: https://github.com/eyalroz/printf
973974
[Nanopb]: https://github.com/nanopb/nanopb
974975
[LVGL]: https://lvgl.io
976+
[RTT]: https://kb.segger.com/RTT
975977
<!--/links-->

examples/blue_pill_f103/rtt/main.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616

1717
using namespace Board;
1818

19-
Rtt rtt(0);
20-
modm::IODeviceObjectWrapper< Rtt, modm::IOBuffer::DiscardIfFull > rtt_device(rtt);
19+
modm::IODeviceWrapper< Rtt<0>, modm::IOBuffer::DiscardIfFull > rtt_device;
2120
// Set all four logger streams to use RTT
2221
modm::log::Logger modm::log::debug(rtt_device);
2322
modm::log::Logger modm::log::info(rtt_device);

examples/blue_pill_f103/rtt/project.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<extends>modm:blue-pill-f103</extends>
33
<options>
44
<option name="modm:build:build.path">../../../build/blue_pill_f103/rtt</option>
5-
<option name="modm:platform:rtt:buffer.rx">16</option>
5+
<option name="modm:rtt:buffer.rx">16</option>
66
</options>
77
<modules>
88
<module>modm:platform:rtt</module>

examples/blue_pill_f103/servo_pwm/main.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414

1515
using namespace Board;
1616

17-
Rtt rtt(0);
18-
modm::IODeviceObjectWrapper< Rtt, modm::IOBuffer::DiscardIfFull > rtt_device(rtt);
17+
modm::IODeviceWrapper< Rtt<0>, modm::IOBuffer::DiscardIfFull > rtt_device;
1918
// Set all four logger streams to use RTT
2019
modm::log::Logger modm::log::debug(rtt_device);
2120
modm::log::Logger modm::log::info(rtt_device);

examples/blue_pill_f103/servo_pwm/project.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<extends>modm:blue-pill-f103</extends>
33
<options>
44
<option name="modm:build:build.path">../../../build/blue_pill_f103/servo_pwm</option>
5-
<option name="modm:platform:rtt:buffer.tx">128</option>
5+
<option name="modm:rtt:buffer.tx">128</option>
66
</options>
77
<modules>
88
<module>modm:build:scons</module>

examples/nucleo_f429zi/spi_flash_fatfs/project.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
<extends>modm:nucleo-f429zi</extends>
33
<options>
44
<option name="modm:build:build.path">../../../build/nucleo_f429zi/spi_flash_fatfs</option>
5-
<option name="modm:platform:rtt:buffer.tx">4096</option>
65
</options>
76
<modules>
87
<module>modm:build:scons</module>

examples/nucleo_l476rg/rtt/main.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515

1616
using namespace Board;
1717

18-
Rtt rtt(0);
19-
modm::IODeviceObjectWrapper< Rtt, modm::IOBuffer::DiscardIfFull > rtt_device(rtt);
18+
modm::IODeviceWrapper< Rtt<0>, modm::IOBuffer::DiscardIfFull > rtt_device;
2019
modm::IOStream rtt_stream(rtt_device);
2120

2221
#undef MODM_LOG_LEVEL

examples/nucleo_l476rg/rtt/project.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<extends>modm:nucleo-l476rg</extends>
33
<options>
44
<option name="modm:build:build.path">../../../build/nucleo_l476rg/rtt</option>
5-
<option name="modm:platform:rtt:buffer.rx">16</option>
5+
<option name="modm:rtt:buffer.rx">16</option>
66
</options>
77
<modules>
88
<module>modm:platform:rtt</module>

examples/stm32f3_discovery/rtt/main.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515

1616
using namespace Board;
1717

18-
Rtt rtt(0);
19-
modm::IODeviceObjectWrapper< Rtt, modm::IOBuffer::DiscardIfFull > rtt_device(rtt);
18+
modm::IODeviceWrapper< Rtt<0>, modm::IOBuffer::DiscardIfFull > rtt_device;
2019
// Set all four logger streams to use RTT
2120
modm::log::Logger modm::log::debug(rtt_device);
2221
modm::log::Logger modm::log::info(rtt_device);
@@ -85,7 +84,13 @@ main()
8584
{
8685
LedNorth::toggle();
8786

88-
MODM_LOG_INFO << "loop: " << counter++ << modm::endl;
87+
MODM_LOG_INFO << "loop: " << counter << modm::endl;
88+
counter++;
89+
}
90+
// loopback: read from channel 1, output on channel 2
91+
if (uint8_t value; SEGGER_RTT_ReadNoLock(1, &value, 1))
92+
{
93+
SEGGER_RTT_WriteNoLock(2, &value, 1);
8994
}
9095
}
9196

examples/stm32f3_discovery/rtt/project.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
<extends>modm:disco-f303vc</extends>
33
<options>
44
<option name="modm:build:build.path">../../../build/stm32f3_discovery/rtt</option>
5-
<option name="modm:platform:rtt:buffer.rx">16</option>
5+
<option name="modm:rtt:buffer.tx">512, 0, 1024</option>
6+
<option name="modm:rtt:buffer.rx">16, 32, 0</option>
67
</options>
78
<modules>
89
<module>modm:platform:rtt</module>

0 commit comments

Comments
 (0)