Skip to content

Commit a042cbb

Browse files
committed
[examples] Deduplicate FLASH example
1 parent 7e2df2f commit a042cbb

File tree

15 files changed

+18
-420
lines changed

15 files changed

+18
-420
lines changed

.github/workflows/linux.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ jobs:
165165
- name: Examples STM32G4 Series
166166
if: always()
167167
run: |
168-
(cd examples && ../tools/scripts/examples_compile.py nucleo_g474re nucleo_g431rb nucleo_g431kb)
168+
(cd examples && ../tools/scripts/examples_compile.py nucleo_g474re)
169169
- name: Examples STM32H7 Series
170170
if: always()
171171
run: |

examples/blue_pill_f103/flash/openocd.cfg

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

examples/blue_pill_f103/flash/project.xml

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

examples/blue_pill_f103/flash/main.cpp renamed to examples/generic/flash/main.cpp

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,15 @@
99
*/
1010

1111
#include <modm/board.hpp>
12-
#include <modm/debug.hpp>
1312
#include <modm/processing.hpp>
1413

1514
using namespace std::chrono_literals;
1615

17-
modm::IODeviceWrapper< Usart2, modm::IOBuffer::BlockIfFull > loggerDevice;
18-
modm::log::Logger modm::log::info(loggerDevice);
19-
20-
// Set the log level
21-
#undef MODM_LOG_LEVEL
22-
#define MODM_LOG_LEVEL modm::log::INFO
23-
2416
// ----------------------------------------------------------------------------
2517
int
2618
main()
2719
{
2820
Board::initialize();
29-
Usart2::connect<GpioOutputA2::Tx, GpioOutputA3::Rx>();
30-
Usart2::initialize<Board::SystemClock, 115200_Bd>();
3121

3222
MODM_LOG_INFO << "\n\nReboot\n";
3323
if (not Flash::unlock()) {
@@ -46,17 +36,16 @@ main()
4636

4737
{
4838
uint32_t err{0};
49-
const uint8_t sector_start = Flash::getSector(Flash::Size / 2);
39+
const uint8_t sector_start = Flash::getSector(Flash::Size/2);
5040
const uint8_t sector_end = Flash::getSector(Flash::Size);
5141
MODM_LOG_INFO << "Erasing sectors [" << sector_start << ", " << sector_end << ")" << modm::endl;
5242
MODM_LOG_INFO.flush();
5343
modm::delay(1s);
5444

5545
const modm::PreciseTimestamp start = modm::PreciseClock::now();
5646

57-
for (uint8_t sector{sector_start}; sector < sector_end; sector++){
47+
for (uint8_t sector{sector_start}; sector < sector_end; sector++)
5848
err |= Flash::erase(sector);
59-
}
6049

6150
const auto diff = (modm::PreciseClock::now() - start);
6251
MODM_LOG_INFO << "Erasing done in " << diff << " with errors: " << err << modm::endl;

examples/generic/flash/project.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<library>
2+
<extends>modm:nucleo-f446re</extends>
3+
<!-- <extends>modm:nucleo-g071rb</extends> -->
4+
<!-- <extends>modm:nucleo-f103rb</extends> -->
5+
<!-- <extends>modm:nucleo-g474re</extends> -->
6+
<!-- <extends>modm:nucleo-g431rb</extends> -->
7+
<options>
8+
<option name="modm:build:build.path">../../../build/generic/flash</option>
9+
</options>
10+
<modules>
11+
<module>modm:platform:flash</module>
12+
<module>modm:processing:timer</module>
13+
<module>modm:build:scons</module>
14+
</modules>
15+
</library>

examples/nucleo_f446re/flash/main.cpp

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

examples/nucleo_f446re/flash/project.xml

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

examples/nucleo_g071rb/flash/main.cpp

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

examples/nucleo_g071rb/flash/project.xml

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

examples/nucleo_g431kb/flash/main.cpp

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

examples/nucleo_g431kb/flash/project.xml

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

0 commit comments

Comments
 (0)