-
Notifications
You must be signed in to change notification settings - Fork 370
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BSP and MCU code is mostly moved from external repository. File with apache license are now in core repository. External files with Atmel license are still in external repository which is referenced in MCU package so there is no need to add this external repo to project.yml manually. Signed-off-by: Jerzy Kasenberg <[email protected]>
- Loading branch information
Showing
41 changed files
with
4,781 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
# | ||
# Called $0 <binary> [identities ...] | ||
# - binary is the path to prefix to target binary, .elf appended to name is | ||
# the ELF file | ||
# - identities is the project identities string. | ||
# | ||
# | ||
source [find interface/cmsis-dap.cfg] | ||
|
||
# chip name | ||
set CHIPNAME at91samd21g18 | ||
set ENDIAN little | ||
set _TARGETNAME $CHIPNAME.cpu | ||
|
||
source [find target/at91samdXX.cfg] | ||
|
||
$_TARGETNAME configure -event gdb-detach {if {[at91samd21g18.cpu curstate] eq "halted"} resume;shutdown} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
/* Linker script for SAMD21 when running from flash and using the bootloader */ | ||
|
||
/* Memory Spaces Definitions */ | ||
MEMORY | ||
{ | ||
FLASH (rx) : ORIGIN = 0x0000c000, LENGTH = 0x18000 | ||
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000 | ||
} | ||
|
||
/* This linker script is used for images and thus contains an image header */ | ||
_imghdr_size = 0x20; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
/* Memory Spaces Definitions */ | ||
MEMORY | ||
{ | ||
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x0000c000 | ||
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000 | ||
} | ||
|
||
/* The bootloader does not contain an image header */ | ||
_imghdr_size = 0x0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/sh | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
# | ||
|
||
# Called with following variables set: | ||
# - CORE_PATH is absolute path to @apache-mynewt-core | ||
# - BSP_PATH is absolute path to hw/bsp/bsp_name | ||
# - BIN_BASENAME is the path to prefix to target binary, | ||
# .elf appended to name is the ELF file | ||
# - FEATURES holds the target features string | ||
# - EXTRA_JTAG_CMD holds extra parameters to pass to jtag software | ||
# - RESET set if target should be reset when attaching | ||
# - NO_GDB set if we should not start gdb to debug | ||
# | ||
|
||
. $CORE_PATH/hw/scripts/openocd.sh | ||
|
||
FILE_NAME=$BIN_BASENAME.elf | ||
CFG="-f $BSP_PATH/arduino_zero.cfg" | ||
|
||
openocd_debug | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/bin/sh | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
# Called with following variables set: | ||
# - CORE_PATH is absolute path to @apache-mynewt-core | ||
# - BSP_PATH is absolute path to hw/bsp/bsp_name | ||
# - BIN_BASENAME is the path to prefix to target binary, | ||
# .elf appended to name is the ELF file | ||
# - IMAGE_SLOT is the image slot to download to (for non-mfg-image, non-boot) | ||
# - FEATURES holds the target features string | ||
# - EXTRA_JTAG_CMD holds extra parameters to pass to jtag software | ||
# - MFG_IMAGE is "1" if this is a manufacturing image | ||
# - FLASH_OFFSET contains the flash offset to download to | ||
# - BOOT_LOADER is set if downloading a bootloader | ||
|
||
. $CORE_PATH/hw/scripts/openocd.sh | ||
|
||
CFG="-f $BSP_PATH/arduino_zero.cfg" | ||
|
||
PROTECT_BOOT=0 | ||
if [ "$MFG_IMAGE" ]; then | ||
FLASH_OFFSET=0x00000000 | ||
PROTECT_BOOT=1 | ||
elif [ "$BOOT_LOADER" ]; then | ||
PROTECT_BOOT=1 | ||
fi | ||
|
||
if [ $PROTECT_BOOT -eq 1 ]; then | ||
# we will unprotect and reprotect our bootloader to ensure that its | ||
# safe. also Arduino Zero Pro boards looks like they come with the | ||
# arduino bootloader protected via the NVM AUX | ||
CFG_POST_INIT="at91samd bootloader 0" | ||
|
||
# XXX reprotect todo | ||
#PROTECT_FLASH="at91samd bootloader 16384" | ||
fi | ||
|
||
common_file_to_load | ||
openocd_load | ||
openocd_reset_run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
# | ||
|
||
bsp.arch: cortex_m0 | ||
bsp.compiler: "@apache-mynewt-core/compiler/arm-none-eabi-m0" | ||
bsp.linkerscript: | ||
- "hw/bsp/arduino_zero/arduino_zero.ld" | ||
- "hw/mcu/atmel/samd21xx/samd21xx.ld" | ||
bsp.linkerscript.BOOT_LOADER.OVERWRITE: | ||
- "hw/bsp/arduino_zero/arduino_zero_boot.ld" | ||
- "hw/mcu/atmel/samd21xx/samd21xx.ld" | ||
bsp.downloadscript: "hw/bsp/arduino_zero/arduino_zero_download.sh" | ||
bsp.debugscript: "hw/bsp/arduino_zero/arduino_zero_debug.sh" | ||
|
||
bsp.flash_map: | ||
areas: | ||
FLASH_AREA_BOOTLOADER: | ||
device: 0 | ||
offset: 0x00000000 | ||
size: 48kB | ||
FLASH_AREA_IMAGE_0: | ||
device: 0 | ||
offset: 0x0000c000 | ||
size: 96kB | ||
FLASH_AREA_IMAGE_1: | ||
device: 0 | ||
offset: 0x00024000 | ||
size: 96kB | ||
FLASH_AREA_IMAGE_SCRATCH: | ||
device: 0 | ||
offset: 0x0003c000 | ||
size: 7kB | ||
|
||
FLASH_AREA_REBOOT_LOG: | ||
user_id: 0 | ||
device: 0 | ||
offset: 0x0003dc00 | ||
size: 1kB | ||
FLASH_AREA_NFFS: | ||
user_id: 1 | ||
device: 0 | ||
offset: 0x0003e000 | ||
size: 8kB |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
/** | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
#ifndef __ARDUINO_BSP_H | ||
#define __ARDUINO_BSP_H | ||
|
||
#include <mcu/mcu.h> | ||
#include "syscfg/syscfg.h" | ||
|
||
#if !MYNEWT_VAL(BSP_ARDUINO_ZERO_PRO) && !MYNEWT_VAL(BSP_ARDUINO_ZERO) | ||
#error you must enable BSP_ARDUINO_ZERO or BSP_ARDUINO_ZERO_PRO in your target syscfg. | ||
#endif | ||
|
||
#include <inttypes.h> | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
enum system_device_id | ||
{ | ||
/* NOTE: Some HALs use a virtual enumeration of the devices, while | ||
* other still use the actual pins (GPIO). For arduino this means | ||
* that the sysIDs for analog and digital pins are the actual pin | ||
* numbers */ | ||
|
||
ARDUINO_ZERO_D0 = (11), | ||
ARDUINO_ZERO_D1 = (10), | ||
ARDUINO_ZERO_D3 = (9), | ||
ARDUINO_ZERO_D5 = (15), | ||
ARDUINO_ZERO_D6 = (20), | ||
ARDUINO_ZERO_D7 = (21), | ||
ARDUINO_ZERO_D8 = (6), | ||
ARDUINO_ZERO_D9 = (7), | ||
ARDUINO_ZERO_D10 = (18), | ||
ARDUINO_ZERO_D11 = (16), | ||
ARDUINO_ZERO_D12 = (19), | ||
ARDUINO_ZERO_D13 = (17), | ||
|
||
#if MYNEWT_VAL(BSP_ARDUINO_ZERO_PRO) | ||
ARDUINO_ZERO_D2 = (8), | ||
ARDUINO_ZERO_D4 = (14), | ||
#endif | ||
|
||
#if MYNEWT_VAL(BSP_ARDUINO_ZERO) | ||
ARDUINO_ZERO_D2 = (14), | ||
ARDUINO_ZERO_D4 = (8), | ||
#endif | ||
#if 0 | ||
ARDUINO_ZERO_A0 = (2), | ||
ARDUINO_ZERO_A1 = (40), | ||
ARDUINO_ZERO_A2 = (41), | ||
ARDUINO_ZERO_A3 = (4), | ||
ARDUINO_ZERO_A4 = (5), | ||
ARDUINO_ZERO_A5 = (34), | ||
#endif | ||
|
||
/* Use SPI 2 */ | ||
ARDUINO_ZERO_SPI_ICSP = 0, | ||
|
||
/* Use SPI 3 */ | ||
ARDUINO_ZERO_SPI_ALT = 1, | ||
|
||
/* a I2c port on SCLK and SDA */ | ||
ARDUINO_ZERO_I2C = 4, | ||
}; | ||
|
||
#define BSP_WINC1500_SPI_PORT 0 | ||
|
||
extern uint8_t _ram_start; | ||
#define RAM_SIZE 0x00008000 | ||
|
||
#define ARDUINO_ZERO_PIN_UART_RX (ARDUINO_ZERO_D0) | ||
#define ARDUINO_ZERO_PIN_UART_TX (ARDUINO_ZERO_D1) | ||
|
||
#define LED_BLINK_PIN (ARDUINO_ZERO_D13) | ||
#define LED_2 (27) | ||
|
||
#define CONSOLE_UART_SPEED 115200 | ||
|
||
/* | ||
* Wiring of Wifi Shield 101 chip to SAMD21. | ||
*/ | ||
#define WINC1500_PIN_RESET /* PA15 */ MCU_GPIO_PORTA(15) | ||
/* WINC1500_PIN_WAKE */ /* NC */ | ||
#define WINC1500_PIN_IRQ /* PA21 */ MCU_GPIO_PORTA(21) | ||
/* WINC1500_PIN_ENABLE */ /* NC */ | ||
|
||
#define WINC1500_SPI_SPEED 4000000 | ||
#define WINC1500_SPI_SSN /* PA18 */ MCU_GPIO_PORTA(18) | ||
#define WINC1500_SPI_SCK /* PB11 */ MCU_GPIO_PORTB(11) | ||
#define WINC1500_SPI_MOSI /* PB10 */ MCU_GPIO_PORTB(10) | ||
#define WINC1500_SPI_MISO /* PA12 */ MCU_GPIO_PORTA(12) | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif /* __ARDUINO_BSP_H */ |
Oops, something went wrong.