Skip to content

Commit c0f0fd0

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into rewrite-graphics-API
2 parents 479cc82 + 9036666 commit c0f0fd0

File tree

23 files changed

+801
-410
lines changed

23 files changed

+801
-410
lines changed

.github/workflows/compile-all.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
name: avr-compile-all
2727
path: test/all/log
2828

29-
samd-compile-all:
29+
sam-compile-all:
3030
if: github.event.label.name == 'ci:hal'
3131
runs-on: ubuntu-20.04
3232
container:
@@ -37,14 +37,14 @@ jobs:
3737
- name: Checkout code and update modm tools
3838
run: |
3939
(git submodule sync && git submodule update --init --jobs 8) & pip3 install --upgrade --upgrade-strategy=eager modm & wait
40-
- name: Compile HAL for all SAMD
40+
- name: Compile HAL for all SAM
4141
run: |
42-
(cd test/all && python3 run_all.py samd --quick-remaining)
42+
(cd test/all && python3 run_all.py sam --quick-remaining)
4343
- name: Upload log artifacts
4444
if: always()
4545
uses: actions/upload-artifact@v2
4646
with:
47-
name: samd-compile-all
47+
name: sam-compile-all
4848
path: test/all/log
4949

5050
stm32f0-compile-all:

.github/workflows/linux.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ jobs:
7676
if: always()
7777
run: |
7878
(cd examples && ../tools/scripts/examples_compile.py samg55_xplained_pro)
79+
- name: Examples SAMV Devices
80+
if: always()
81+
run: |
82+
(cd examples && ../tools/scripts/examples_compile.py samv)
7983
- name: Execute Python Scripts
8084
if: always()
8185
run: |
@@ -217,7 +221,7 @@ jobs:
217221
- name: Quick compile HAL for Cortex-M Part 1
218222
if: always()
219223
run: |
220-
(cd test/all && python3 run_all.py stm32 samd --quick --split 4 --part 0)
224+
(cd test/all && python3 run_all.py stm32 sam --quick --split 4 --part 0)
221225
- name: Upload log artifacts
222226
uses: actions/upload-artifact@v2
223227
with:
@@ -237,7 +241,7 @@ jobs:
237241
- name: Quick compile HAL for Cortex-M Part 2
238242
if: always()
239243
run: |
240-
(cd test/all && python3 run_all.py stm32 samd --quick --split 4 --part 1)
244+
(cd test/all && python3 run_all.py stm32 sam --quick --split 4 --part 1)
241245
- name: Upload log artifacts
242246
uses: actions/upload-artifact@v2
243247
with:
@@ -257,7 +261,7 @@ jobs:
257261
- name: Quick compile HAL for Cortex-M Part 3
258262
if: always()
259263
run: |
260-
(cd test/all && python3 run_all.py stm32 samd --quick --split 4 --part 2)
264+
(cd test/all && python3 run_all.py stm32 sam --quick --split 4 --part 2)
261265
- name: Upload log artifacts
262266
uses: actions/upload-artifact@v2
263267
with:
@@ -277,7 +281,7 @@ jobs:
277281
- name: Quick compile HAL for Cortex-M Part 4
278282
if: always()
279283
run: |
280-
(cd test/all && python3 run_all.py stm32 samd --quick --split 4 --part 3)
284+
(cd test/all && python3 run_all.py stm32 sam --quick --split 4 --part 3)
281285
- name: Upload log artifacts
282286
uses: actions/upload-artifact@v2
283287
with:

README.md

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ git clone --recurse-submodules --jobs 8 https://github.com/modm-io/modm.git
7474

7575
## Microcontrollers
7676

77-
modm can create a HAL for <!--allcount-->3175<!--/allcount--> devices of these vendors:
77+
modm can create a HAL for <!--allcount-->3195<!--/allcount--> devices of these vendors:
7878

7979
- STMicroelectronics STM32: <!--stmcount-->2621<!--/stmcount--> devices.
80-
- Microchip SAM: <!--samcount-->166<!--/samcount--> devices.
80+
- Microchip SAM: <!--samcount-->186<!--/samcount--> devices.
8181
- Microchip AVR: <!--avrcount-->388<!--/avrcount--> devices.
8282

8383
Here is a table with all device families and the peripheral drivers they support:
@@ -96,7 +96,7 @@ Please [discover modm's peripheral drivers for your specific device][discover].
9696
<tr>
9797
<th align="center"></th>
9898
<th align="center" colspan="12">STM32</th>
99-
<th align="center" colspan="2">SAM</th>
99+
<th align="center" colspan="3">SAM</th>
100100
<th align="center" colspan="3">AT</th>
101101
</tr><tr>
102102
<th align="left">Peripheral</th>
@@ -113,7 +113,8 @@ Please [discover modm's peripheral drivers for your specific device][discover].
113113
<th align="center">L1</th>
114114
<th align="center">L4</th>
115115
<th align="center">D21</th>
116-
<th align="center">G</th>
116+
<th align="center">G55</th>
117+
<th align="center">V70</th>
117118
<th align="center">90</th>
118119
<th align="center">Mega</th>
119120
<th align="center">Tiny</th>
@@ -134,6 +135,7 @@ Please [discover modm's peripheral drivers for your specific device][discover].
134135
<td align="center">○</td>
135136
<td align="center">○</td>
136137
<td align="center">○</td>
138+
<td align="center">○</td>
137139
<td align="center">✅</td>
138140
<td align="center">✅</td>
139141
</tr><tr>
@@ -154,6 +156,7 @@ Please [discover modm's peripheral drivers for your specific device][discover].
154156
<td align="center">✗</td>
155157
<td align="center">○</td>
156158
<td align="center">○</td>
159+
<td align="center">○</td>
157160
<td align="center">✗</td>
158161
</tr><tr>
159162
<td align="left">Comparator</td>
@@ -174,6 +177,7 @@ Please [discover modm's peripheral drivers for your specific device][discover].
174177
<td align="center">○</td>
175178
<td align="center">○</td>
176179
<td align="center">○</td>
180+
<td align="center">○</td>
177181
</tr><tr>
178182
<td align="left">DAC</td>
179183
<td align="center">✅</td>
@@ -190,6 +194,7 @@ Please [discover modm's peripheral drivers for your specific device][discover].
190194
<td align="center">✅</td>
191195
<td align="center">○</td>
192196
<td align="center">✗</td>
197+
<td align="center">○</td>
193198
<td align="center">✗</td>
194199
<td align="center">○</td>
195200
<td align="center">✗</td>
@@ -209,6 +214,7 @@ Please [discover modm's peripheral drivers for your specific device][discover].
209214
<td align="center">✅</td>
210215
<td align="center">○</td>
211216
<td align="center">✗</td>
217+
<td align="center">○</td>
212218
<td align="center">✗</td>
213219
<td align="center">✗</td>
214220
<td align="center">✗</td>
@@ -231,6 +237,7 @@ Please [discover modm's peripheral drivers for your specific device][discover].
231237
<td align="center">✗</td>
232238
<td align="center">✗</td>
233239
<td align="center">✗</td>
240+
<td align="center">✗</td>
234241
</tr><tr>
235242
<td align="left">External Interrupt</td>
236243
<td align="center">✅</td>
@@ -246,7 +253,8 @@ Please [discover modm's peripheral drivers for your specific device][discover].
246253
<td align="center">✅</td>
247254
<td align="center">✅</td>
248255
<td align="center">✅</td>
249-
<td align="center">✅</td>
256+
<td align="center">✗</td>
257+
<td align="center">✗</td>
250258
<td align="center">✅</td>
251259
<td align="center">✅</td>
252260
<td align="center">✅</td>
@@ -266,6 +274,7 @@ Please [discover modm's peripheral drivers for your specific device][discover].
266274
<td align="center">○</td>
267275
<td align="center">✗</td>
268276
<td align="center">✗</td>
277+
<td align="center">○</td>
269278
<td align="center">✗</td>
270279
<td align="center">✗</td>
271280
<td align="center">✗</td>
@@ -288,6 +297,7 @@ Please [discover modm's peripheral drivers for your specific device][discover].
288297
<td align="center">✅</td>
289298
<td align="center">✅</td>
290299
<td align="center">✅</td>
300+
<td align="center">✅</td>
291301
</tr><tr>
292302
<td align="left">I<sup>2</sup>C</td>
293303
<td align="center">✅</td>
@@ -304,6 +314,7 @@ Please [discover modm's peripheral drivers for your specific device][discover].
304314
<td align="center">✅</td>
305315
<td align="center">○</td>
306316
<td align="center">○</td>
317+
<td align="center">○</td>
307318
<td align="center">✅</td>
308319
<td align="center">✅</td>
309320
<td align="center">✅</td>
@@ -322,7 +333,8 @@ Please [discover modm's peripheral drivers for your specific device][discover].
322333
<td align="center">○</td>
323334
<td align="center">○</td>
324335
<td align="center">○</td>
325-
<td align="center">✗</td>
336+
<td align="center">○</td>
337+
<td align="center">○</td>
326338
<td align="center">✗</td>
327339
<td align="center">✗</td>
328340
<td align="center">✗</td>
@@ -342,6 +354,7 @@ Please [discover modm's peripheral drivers for your specific device][discover].
342354
<td align="center">✅</td>
343355
<td align="center">✗</td>
344356
<td align="center">✗</td>
357+
<td align="center">○</td>
345358
<td align="center">✗</td>
346359
<td align="center">✗</td>
347360
<td align="center">✗</td>
@@ -361,6 +374,7 @@ Please [discover modm's peripheral drivers for your specific device][discover].
361374
<td align="center">✅</td>
362375
<td align="center">○</td>
363376
<td align="center">✅</td>
377+
<td align="center">○</td>
364378
<td align="center">✅</td>
365379
<td align="center">✅</td>
366380
<td align="center">✅</td>
@@ -383,6 +397,7 @@ Please [discover modm's peripheral drivers for your specific device][discover].
383397
<td align="center">✗</td>
384398
<td align="center">✗</td>
385399
<td align="center">✗</td>
400+
<td align="center">✗</td>
386401
</tr><tr>
387402
<td align="left">Timer</td>
388403
<td align="center">✅</td>
@@ -402,6 +417,7 @@ Please [discover modm's peripheral drivers for your specific device][discover].
402417
<td align="center">○</td>
403418
<td align="center">○</td>
404419
<td align="center">○</td>
420+
<td align="center">○</td>
405421
</tr><tr>
406422
<td align="left">UART</td>
407423
<td align="center">✅</td>
@@ -418,6 +434,7 @@ Please [discover modm's peripheral drivers for your specific device][discover].
418434
<td align="center">✅</td>
419435
<td align="center">✅</td>
420436
<td align="center">○</td>
437+
<td align="center">○</td>
421438
<td align="center">✅</td>
422439
<td align="center">✅</td>
423440
<td align="center">○</td>
@@ -440,6 +457,7 @@ Please [discover modm's peripheral drivers for your specific device][discover].
440457
<td align="center">✗</td>
441458
<td align="center">✗</td>
442459
<td align="center">✗</td>
460+
<td align="center">✗</td>
443461
</tr><tr>
444462
<td align="left">USB</td>
445463
<td align="center">✅</td>
@@ -456,6 +474,7 @@ Please [discover modm's peripheral drivers for your specific device][discover].
456474
<td align="center">✅</td>
457475
<td align="center">✅</td>
458476
<td align="center">✅</td>
477+
<td align="center">○</td>
459478
<td align="center">✗</td>
460479
<td align="center">✗</td>
461480
<td align="center">✗</td>

examples/samv/blink/main.cpp

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*
2+
* Copyright (c) 2021, Tomasz Wasilczyk
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+
#include <modm/architecture/interface/clock.hpp>
12+
#include <modm/platform.hpp>
13+
14+
using namespace std::chrono_literals;
15+
using namespace modm::platform;
16+
17+
struct SystemClock
18+
{
19+
// Chosen to achieve 300MHz system clock
20+
static constexpr uint32_t PllAMult = 25;
21+
static constexpr uint32_t Frequency = 300'000'000; // PllAMult * Osc 12MHz
22+
23+
static bool inline
24+
enable()
25+
{
26+
ClockGen::setFlashLatency<Frequency / 2>(); // Flash runs off MCK
27+
28+
ClockGen::enableMainInternal(MainInternalFreq::Rc12Mhz);
29+
ClockGen::selectMainClockSource(MainClockSource::Internal);
30+
ClockGen::enablePllA<PllAMult>();
31+
ClockGen::selectMasterClk<MasterClkSource::PLLA_CLK, MasterClkPrescaler::CLK_1, MasterClkDivider::Div2>();
32+
ClockGen::updateCoreFrequency<Frequency>();
33+
34+
return true;
35+
}
36+
};
37+
38+
using Led0 = GpioD17;
39+
using Led1 = GpioD16;
40+
using Led2 = GpioD15;
41+
42+
int
43+
main()
44+
{
45+
WDT->WDT_MR = (WDT_MR_WDDIS_Msk); // turn off Watchdog
46+
47+
SystemClock::enable();
48+
SysTickTimer::initialize<SystemClock>();
49+
50+
Led0::setOutput(false);
51+
Led1::setOutput(true);
52+
Led2::setOutput(false);
53+
54+
while (1)
55+
{
56+
Led0::toggle();
57+
modm::delay(500ms);
58+
}
59+
60+
return 0;
61+
}

examples/samv/blink/openocd.cfg

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
source [find interface/jlink.cfg]
2+
transport select swd
3+
4+
source [find target/atsamv.cfg]
5+
6+
# Set boot mode selection to Flash (instead of SAM-BA on ROM)
7+
init
8+
halt
9+
atsamv gpnvm set 1

examples/samv/blink/project.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<library>
2+
<options>
3+
<option name="modm:target">samv70n20b-aabt</option>
4+
<option name="modm:build:build.path">../../../build/samv/blink</option>
5+
<option name="modm:build:openocd.cfg">openocd.cfg</option>
6+
</options>
7+
<modules>
8+
<module>modm:build:scons</module>
9+
<module>modm:platform:core</module>
10+
<module>modm:platform:clock</module>
11+
<module>modm:platform:gpio</module>
12+
<module>modm:architecture:delay</module>
13+
<module>modm:platform:clockgen</module>
14+
</modules>
15+
</library>

ext/microchip/sam

Submodule sam updated 216 files

repo.lb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,7 @@ class DevicesCache(dict):
8686
"stm32h7",
8787
"stm32l0", "stm32l1", "stm32l4",
8888
"at90", "attiny", "atmega",
89-
"samd21",
90-
"samg55",
89+
"samd21", "samg55", "samv70",
9190
"hosted"]
9291
device_file_names = [dfn for dfn in device_file_names if any(s in dfn for s in supported)]
9392
# These files are ignored due to various issues

src/modm/platform/clock/sam/gclk.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ ClockGenerator : uint32_t
3535
Internal8M = 3,
3636
};
3737

38-
enum class ClockPeripheral : uint32_t {
38+
enum class
39+
ClockPeripheral : uint32_t
40+
{
3941
Dfll48 = GCLK_CLKCTRL_ID_DFLL48_Val,
4042
Fdpll = GCLK_CLKCTRL_ID_FDPLL_Val,
4143
Fdpll32K = GCLK_CLKCTRL_ID_FDPLL32K_Val,

0 commit comments

Comments
 (0)