Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
7457c0c
add config files
sabas1080 May 12, 2021
eb47681
add makefile saml21
sabas1080 May 12, 2021
9a67c07
add more saml21
sabas1080 May 12, 2021
d5fcc5b
fix if's makefile
sabas1080 May 12, 2021
f773d2e
fix ifdef port
sabas1080 May 12, 2021
6d7b608
Add board SAML21
sabas1080 May 12, 2021
604e663
add more ifdef for SAML21
sabas1080 May 12, 2021
c52f6c3
add SAML21 to mpconfigport
sabas1080 May 12, 2021
fe62cea
added more directives for SAML21 in port and mphalport
sabas1080 May 12, 2021
d835f86
active tinyusb for SAML21
sabas1080 May 12, 2021
f0efd45
more add SAML21
sabas1080 May 14, 2021
1270a0c
add saml_cpu and more directives SAML21
sabas1080 May 16, 2021
cf495da
update asf4_config
sabas1080 May 16, 2021
a1f2271
update boards
wero1414 Jun 7, 2021
22bb736
update clocks
wero1414 Jun 7, 2021
296b04d
add led flashing
wero1414 Jun 7, 2021
db71bb1
update clocks on peripherals
wero1414 Jun 7, 2021
b63ceca
add wero_init functiion
wero1414 Jun 18, 2021
6ca62e1
Update main.c
sabas1080 Jun 21, 2021
f326eb6
Updated submodule lib/tinyusb
sabas1080 Jun 21, 2021
e19543c
Update build.yml
sabas1080 Jun 21, 2021
c17d4df
gitmodules update for CI
sabas1080 Jun 21, 2021
d0e526d
Update port.c
sabas1080 Jun 21, 2021
32cacf3
Revert "gitmodules update for CI"
sabas1080 Jun 21, 2021
fbeef92
fix PID
sabas1080 Jun 21, 2021
f305bec
pre-commit format
sabas1080 Jun 21, 2021
9623d10
fix ident port.c
sabas1080 Jun 22, 2021
0e7e19c
restart clock init
sabas1080 Jun 23, 2021
5cebce8
comment line with bug on flash
wero1414 Jun 29, 2021
2258ce9
modify usb init
wero1414 Jul 6, 2021
b7e64ea
modify asf4_conf
wero1414 Jul 6, 2021
fefff3c
check pre-commit
sabas1080 Jul 6, 2021
d93b73a
update tinyusb
sabas1080 Aug 19, 2021
9a7061c
update module peripherals
sabas1080 Aug 20, 2021
d455bf0
Update submodule asf4
sabas1080 Aug 20, 2021
47bd598
Add AudioOut for SAML21
sabas1080 Aug 30, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ jobs:
- "arduino_nano_33_iot"
- "arduino_zero"
- "bast_pro_mini_m0"
- "bast_saml21"
- "bastble"
- "bdmicro_vina_d21"
- "bdmicro_vina_d51"
Expand Down
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
url = https://github.com/k-bx/python-semver.git
[submodule "atmel-samd/asf4"]
path = ports/atmel-samd/asf4
url = https://github.com/adafruit/asf4.git
url = https://github.com/UVA-DSI/asf4.git
branch = circuitpython
[submodule "tools/usb_descriptor"]
path = tools/usb_descriptor
Expand Down Expand Up @@ -66,7 +66,7 @@
url = https://github.com/adafruit/Adafruit_CircuitPython_DotStar.git
[submodule "ports/atmel-samd/peripherals"]
path = ports/atmel-samd/peripherals
url = https://github.com/adafruit/samd-peripherals.git
url = https://github.com/UVA-DSI/samd-peripherals
[submodule "frozen/Adafruit_CircuitPython_Crickit"]
path = frozen/Adafruit_CircuitPython_Crickit
url = https://github.com/adafruit/Adafruit_CircuitPython_Crickit
Expand Down
2 changes: 1 addition & 1 deletion lib/tinyusb
Submodule tinyusb updated 356 files
36 changes: 31 additions & 5 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,12 @@ STATIC void __attribute__ ((noinline)) run_boot_py(safe_mode_t safe_mode) {
#endif
}

void delay(unsigned long milis){
for(unsigned long i=0;i<milis;i++){
__asm("NOP");
}
}

STATIC int run_repl(void) {
int exit_code = PYEXEC_FORCED_EXIT;
stack_resize();
Expand Down Expand Up @@ -585,14 +591,33 @@ int __attribute__((used)) main(void) {
safe_mode_t safe_mode = port_init();

// Turn on LEDs
init_status_leds();
rgb_led_status_init();
//init_status_leds();
//rgb_led_status_init();

//port regs = 0x40002800
int *pt;
//PAC
//pt = (int *)0x44000000;
//*pt =0x00FF000AU;
//Port stuff
pt = (int *)0x40002800;
*pt =1<<23;
pt = (int *)0x40002810;
//pt =1<23;
for(int i=0;i<5;i++){
//while(1){
*pt=1<<23;
delay(10);
*pt=0x00000000;
delay(10);
}

// Wait briefly to give a reset window where we'll enter safe mode after the reset.
if (safe_mode == NO_SAFE_MODE) {
safe_mode = wait_for_safe_mode_reset();
}


stack_init();

// Create a new filesystem only if we're not in a safe mode.
Expand All @@ -601,13 +626,15 @@ int __attribute__((used)) main(void) {
filesystem_init(safe_mode == NO_SAFE_MODE, false);

// displays init after filesystem, since they could share the flash SPI
board_init();
//board_init();

// Start the debug serial
serial_early_init();
//serial_early_init();

// Reset everything and prep MicroPython to run boot.py.
#if 1
reset_port();
#endif
// Port-independent devices, like CIRCUITPY_BLEIO_HCI.
reset_devices();
reset_board();
Expand All @@ -624,7 +651,6 @@ int __attribute__((used)) main(void) {
// writable over USB. Set it here so that boot.py can change it.
filesystem_set_internal_concurrent_write_protection(true);
filesystem_set_internal_writable_by_usb(true);

run_boot_py(safe_mode);

// Start USB after giving boot.py a chance to tweak behavior.
Expand Down
29 changes: 29 additions & 0 deletions ports/atmel-samd/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,13 @@ OPTIMIZATION_FLAGS ?= -Os
CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_SAMD21 -DCFG_TUD_MIDI_RX_BUFSIZE=128 -DCFG_TUD_CDC_RX_BUFSIZE=128 -DCFG_TUD_MIDI_TX_BUFSIZE=128 -DCFG_TUD_CDC_TX_BUFSIZE=128 -DCFG_TUD_MSC_BUFSIZE=512
endif

ifeq ($(CHIP_FAMILY), saml21)
PERIPHERALS_CHIP_FAMILY=saml21
OPTIMIZATION_FLAGS ?= -Os
# TinyUSB defines
CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_SAMD21 -DCFG_TUD_MIDI_RX_BUFSIZE=128 -DCFG_TUD_CDC_RX_BUFSIZE=128 -DCFG_TUD_MIDI_TX_BUFSIZE=128 -DCFG_TUD_CDC_TX_BUFSIZE=128 -DCFG_TUD_MSC_BUFSIZE=512
endif

ifeq ($(CHIP_FAMILY), samd51)
PERIPHERALS_CHIP_FAMILY=sam_d5x_e5x
OPTIMIZATION_FLAGS ?= -O2 -fno-inline-functions
Expand Down Expand Up @@ -130,6 +137,9 @@ ifeq ($(DEBUG), 1)
ifeq ($(CHIP_FAMILY), samd21)
CFLAGS += -DENABLE_MICRO_TRACE_BUFFER
endif
ifeq ($(CHIP_FAMILY), saml21)
CFLAGS += -DENABLE_MICRO_TRACE_BUFFER
endif
else
CFLAGS += -DNDEBUG
# -finline-limit can shrink the image size.
Expand Down Expand Up @@ -169,6 +179,15 @@ CFLAGS += \
-mfloat-abi=soft \
-DSAMD21
endif
ifeq ($(CHIP_FAMILY), saml21)
CFLAGS += \
-mthumb \
-mabi=aapcs-linux \
-mcpu=cortex-m0plus \
-msoft-float \
-mfloat-abi=soft \
-DSAML21
endif
ifeq ($(CHIP_FAMILY), samd51)
CFLAGS += \
-mthumb \
Expand Down Expand Up @@ -211,6 +230,9 @@ endif
ifeq ($(CHIP_FAMILY), samd21)
LDFLAGS += -mthumb -mcpu=cortex-m0plus -Lasf/thirdparty/CMSIS/Lib/GCC/
BOOTLOADER_SIZE := 0x2000
else ifeq ($(CHIP_FAMILY), saml21)
LDFLAGS += -mthumb -mcpu=cortex-m0plus -Lasf/thirdparty/CMSIS/Lib/GCC/
BOOTLOADER_SIZE := 0x2000
else ifeq ($(CHIP_FAMILY), samd51)
LDFLAGS += -mthumb -mcpu=cortex-m4
BOOTLOADER_SIZE := 0x4000
Expand Down Expand Up @@ -253,6 +275,13 @@ SRC_ASF += \
hpl/core/hpl_core_m0plus_base.c \
hpl/sysctrl/hpl_sysctrl.c \

else ifeq ($(CHIP_FAMILY), saml21)
SRC_ASF += \
hpl/core/hpl_core_m0plus_base.c \
hpl/mclk/hpl_mclk.c \
hpl/osc32kctrl/hpl_osc32kctrl.c \
hpl/oscctrl/hpl_oscctrl.c \

else ifeq ($(CHIP_FAMILY), samd51)
SRC_ASF += \
hal/src/hal_rand_sync.c \
Expand Down
2 changes: 1 addition & 1 deletion ports/atmel-samd/asf4
Submodule asf4 updated from 84f56a to c9c2c1
Loading