Add Microchip SAM series MCU support for RT-Thread (#5771)
* Add Microchip SAM series MCU support for RT-Thread Add Microchip SAM series MCU support for RT-Thread, including SAM Cortex-M0+, M4F and M7. * Add bsp directory to ignored check list Add bsp directory to ignored check list, add microchip /samc21/same54/same70 to workflows list * remove STDIO definition and bug fix 1. remove STDIO code from Microchip official BSP. 2. bug fix of SAME70 hpl/hpl_usart.c, samc21&same54 hpl/hpl_sercom.c baudrate update interface. 3. Add RT-Thread standard STDIO implementation on Microchip SAM MCU. * add CAN driver & example and script fix Add CAN driver and example for SAMC21/SAME5x/SAME70 and fix rtconfig.py issue(unused space might result link error) * Add Chinese version README Add Chinese version README for SAMC21/E54/E70
3
.github/workflows/action.yml
vendored
@@ -168,6 +168,9 @@ jobs:
|
||||
- {RTT_BSP: "raspberry-pi/raspi3-64", RTT_TOOL_CHAIN: "sourcery-aarch64"}
|
||||
- {RTT_BSP: "raspberry-pi/raspi4-64", RTT_TOOL_CHAIN: "sourcery-aarch64"}
|
||||
- {RTT_BSP: "rockchip/rk3568", RTT_TOOL_CHAIN: "sourcery-aarch64"}
|
||||
- {RTT_BSP: "microchip/samc21", RTT_TOOL_CHAIN: "sourcery-arm"}
|
||||
- {RTT_BSP: "microchip/same54", RTT_TOOL_CHAIN: "sourcery-arm"}
|
||||
- {RTT_BSP: "microchip/same70", RTT_TOOL_CHAIN: "sourcery-arm"}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up Python
|
||||
|
||||
218
bsp/microchip/README.md
Normal file
@@ -0,0 +1,218 @@
|
||||
# 1. Microchip BSP Introduction
|
||||
|
||||
Supported Microchip SAM (ARM Cortex-Mx Core) MCU is as following:
|
||||
|
||||
## ARM Cortex-M0+ Series
|
||||
- samc21 | 5V Cortex-M0+ with 2 CAN-FD support
|
||||
- saml21 | 3.3V low power Cortex-M0+
|
||||
- samd21 | 3.3V industrial level Cortex-M0+
|
||||
|
||||
## ARM Cortex-M4 Series
|
||||
- same54 | 3.3V 120MHz Cortex-M4F core with CAN-FD/USB/Ethernet support
|
||||
|
||||
## ARM Cortex-M7 Series
|
||||
- same70 | 3.3V 300MHz Cortex-M7 core with CAN-FD/High speed USB/Ethernet support
|
||||
|
||||
## Directory description:
|
||||
* applications:
|
||||
* user main function entrance,
|
||||
* driver example - like i2c, can, adc ...
|
||||
* application example
|
||||
* board:
|
||||
* user board initialization
|
||||
* user driver adpater code, like console device, ethernet device
|
||||
* bsp:
|
||||
* MCU BSP files - startup file, peripheral drivers, configuation headers and linker script
|
||||
* generated from start.atmel.com - DO NOT modify it
|
||||
|
||||
# 2. RT-Thread porting guide of Microchip SAM MCU
|
||||
|
||||
## 2.1 Configure project BSP on Atmel Start
|
||||
|
||||
* Visit <https://start.atmel.com/#> and click CREATE NEW PROJECT.
|
||||
|
||||

|
||||
|
||||
* Input MCU part number and then select device, click CREATE NEW PROJECT.
|
||||
|
||||

|
||||
|
||||
* Add STDIO and other driver/middleware to project.
|
||||
|
||||

|
||||
|
||||
* Configure STDIO driver.
|
||||
|
||||

|
||||
|
||||
* Configure CAN module clock.
|
||||
|
||||

|
||||
|
||||
* Configure CAN module driver.
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
* Add LED pin description.
|
||||
|
||||

|
||||
|
||||
* Rename project.
|
||||
|
||||

|
||||
|
||||
* Save project configuration.
|
||||
|
||||

|
||||
|
||||
* Export project source code.
|
||||
|
||||

|
||||
|
||||
## 2.2 Add project to RT-Thread source code
|
||||
|
||||
* Link: <https://github.com/RT-Thread/rt-thread> and download RT souce code.
|
||||
|
||||

|
||||
|
||||
* Unzip downloaded RT-Thread and SAME70 CAN Example
|
||||
|
||||

|
||||
|
||||
* Enter rt-thread-xxx/bsp/microchip directory and copy same70 folder and rename it to same70q20.
|
||||
|
||||

|
||||
|
||||
* Enter same70q20 directory and remove all files except SConscript file.
|
||||
|
||||

|
||||
|
||||
* Copy all files from SAME70 CAN Example to rt-thread-xxx/bsp/microchip/same70q20/bsp.
|
||||
|
||||

|
||||
|
||||
* Modify rt-thread-xxx\bsp\microchip\same70q20\rtconfig.py.
|
||||
|
||||

|
||||
|
||||
* Modify rt-thread-xxx\bsp\microchip\same70q20\bsp\SConscript.
|
||||
|
||||

|
||||
|
||||
* Modify rt-thread-xxx\bsp\microchip\same70q20\bsp\same70b\gcc\gcc\same70q20b_flash.ld.
|
||||
|
||||

|
||||
|
||||
* Modify rt-thread-xxx\bsp\microchip\same70q20\bsp\same70b\gcc\gcc\startup_same70q20b.c.
|
||||
|
||||

|
||||
|
||||
* Alright, now you can use RT-Thread env tools to compile the project.
|
||||
|
||||
## 2.3 Compile project with RT-Thread env tools
|
||||
|
||||
About RT-Thread env tools, click [Here](https://github.com/RT-Thread/rt-thread/blob/master/documentation/env/env.md).
|
||||
|
||||
* Download RT-Thread env tools <https://www.rt-thread.org/page/download.html>
|
||||
|
||||

|
||||
|
||||
* Unzip downloaded file and run env.exe.
|
||||
|
||||

|
||||
|
||||
* Enter your project directory and run scons command to compile it.
|
||||
|
||||

|
||||
|
||||
* Compile error you may have and proposed solution.
|
||||
|
||||

|
||||
|
||||
* Fix compiling error
|
||||
|
||||

|
||||
|
||||
* Compiling success
|
||||
|
||||

|
||||
|
||||
* In the following chapter I will show you how to debug RT-Thread with Studio 7.
|
||||
|
||||
# 3. RT-Thread debugging with Microchip IDE
|
||||
|
||||
* Link: <https://www.microchip.com/en-us/tools-resources/develop/microchip-studio>, download & install Microchip Studio 7.
|
||||
|
||||

|
||||
|
||||
* Open installed Microchip Studio 7 and open object file for debugging.
|
||||
|
||||

|
||||
|
||||
* Choose object file, fill project name and select where to save this project.
|
||||
|
||||

|
||||
|
||||
* Select the right part number and complete object set up.
|
||||
|
||||

|
||||
|
||||
* Object file import complete and you can see related files are linked to project.
|
||||
|
||||

|
||||
|
||||
* Right click the project and choose the debug tools in project propertities setting.
|
||||
|
||||

|
||||
|
||||
* Choose debugger/programmer and debugger interface - SWD or JTGA.
|
||||
|
||||

|
||||
|
||||
* Press debugging button and enjoy your debugging journey.
|
||||
|
||||

|
||||
|
||||
* Debugging start and you can add breakpoint.
|
||||
|
||||

|
||||
|
||||
* Debugging paused at breakpoint and you can monitor local variables at Watch window.
|
||||
|
||||

|
||||
|
||||
|
||||
# 4. Reconfigure MCU BSP
|
||||
|
||||
* Visit <https://start.atmel.com/#> and upload project configuration.
|
||||
|
||||

|
||||
|
||||
* Now you can reconfigure your project.
|
||||
|
||||

|
||||
|
||||
|
||||
# 5. Microchip SAM MCU BSP configuration and user guide
|
||||
|
||||
* Please refer to <ASF4 API Reference Manual> for more details
|
||||
[ASF4 API Reference Manual](https://ww1.microchip.com/downloads/en/DeviceDoc/50002633B.pdf)
|
||||
|
||||
## 5.1 SAMC2x/E5x/E70 CAN Driver
|
||||
|
||||
* CAN driver configuration.
|
||||
|
||||

|
||||

|
||||
|
||||
* CAN driver user guide - see <ASF4 API Reference Manual.pdf> P121 for more details.
|
||||
|
||||
* To be continued.
|
||||
|
||||
# 6. Contact Info
|
||||
|
||||
- [Kevin Liu](https://github.com/klmchp)
|
||||
|
||||
* https://github.com/klmchp && kevin.liu.mchp@gmail.com
|
||||
BIN
bsp/microchip/doc/2-1-1-atmel-start-online - Copy.png
Normal file
|
After Width: | Height: | Size: 299 KiB |
BIN
bsp/microchip/doc/2-1-1-atmel-start-online.png
Normal file
|
After Width: | Height: | Size: 300 KiB |
BIN
bsp/microchip/doc/2-1-10-atmel-start-export-project.png
Normal file
|
After Width: | Height: | Size: 142 KiB |
BIN
bsp/microchip/doc/2-1-2-atmel-start-newproject.png
Normal file
|
After Width: | Height: | Size: 225 KiB |
BIN
bsp/microchip/doc/2-1-3-atmel-start-add-STDIO.png
Normal file
|
After Width: | Height: | Size: 110 KiB |
BIN
bsp/microchip/doc/2-1-4-atmel-start-driver-stdio.png
Normal file
|
After Width: | Height: | Size: 201 KiB |
BIN
bsp/microchip/doc/2-1-5-atmel-start-can-clock.png
Normal file
|
After Width: | Height: | Size: 178 KiB |
BIN
bsp/microchip/doc/2-1-6-atmel-start-driver-can0.png
Normal file
|
After Width: | Height: | Size: 130 KiB |
BIN
bsp/microchip/doc/2-1-6-atmel-start-driver-can1.png
Normal file
|
After Width: | Height: | Size: 160 KiB |
BIN
bsp/microchip/doc/2-1-7-atmel-start-rename-project.png
Normal file
|
After Width: | Height: | Size: 68 KiB |
BIN
bsp/microchip/doc/2-1-8-atmel-start-add-LED0.png
Normal file
|
After Width: | Height: | Size: 167 KiB |
BIN
bsp/microchip/doc/2-1-9-atmel-start-save-configuration.png
Normal file
|
After Width: | Height: | Size: 164 KiB |
BIN
bsp/microchip/doc/2-2-1-atmel-start-download-RT-Thread.png
Normal file
|
After Width: | Height: | Size: 40 KiB |
BIN
bsp/microchip/doc/2-2-2-atmel-start-unzip-file.png
Normal file
|
After Width: | Height: | Size: 29 KiB |
BIN
bsp/microchip/doc/2-2-3-atmel-start-copy-file.png
Normal file
|
After Width: | Height: | Size: 44 KiB |
BIN
bsp/microchip/doc/2-2-4-atmel-start-remove-old-files.png
Normal file
|
After Width: | Height: | Size: 74 KiB |
BIN
bsp/microchip/doc/2-2-5-atmel-start-copy-files.png
Normal file
|
After Width: | Height: | Size: 88 KiB |
BIN
bsp/microchip/doc/2-2-6-atmel-start-modify-file0.png
Normal file
|
After Width: | Height: | Size: 65 KiB |
BIN
bsp/microchip/doc/2-2-6-atmel-start-modify-file1.png
Normal file
|
After Width: | Height: | Size: 70 KiB |
BIN
bsp/microchip/doc/2-2-6-atmel-start-modify-file2.png
Normal file
|
After Width: | Height: | Size: 26 KiB |
BIN
bsp/microchip/doc/2-2-6-atmel-start-modify-file3.png
Normal file
|
After Width: | Height: | Size: 57 KiB |
BIN
bsp/microchip/doc/2-3-1-atmel-start-download-env-tools.png
Normal file
|
After Width: | Height: | Size: 31 KiB |
BIN
bsp/microchip/doc/2-3-2-atmel-start-run-env-tools.png
Normal file
|
After Width: | Height: | Size: 25 KiB |
BIN
bsp/microchip/doc/2-3-3-atmel-start-env-tools-compile.png
Normal file
|
After Width: | Height: | Size: 24 KiB |
BIN
bsp/microchip/doc/2-3-4-atmel-start-env-tools-errors.png
Normal file
|
After Width: | Height: | Size: 19 KiB |
BIN
bsp/microchip/doc/2-3-5-atmel-start-env-tools-fixerrors.png
Normal file
|
After Width: | Height: | Size: 30 KiB |
BIN
bsp/microchip/doc/2-3-6-atmel-start-env-tools-compiling-OK.png
Normal file
|
After Width: | Height: | Size: 20 KiB |
BIN
bsp/microchip/doc/3-1-1-atmel-start-Studio7-download.png
Normal file
|
After Width: | Height: | Size: 91 KiB |
BIN
bsp/microchip/doc/3-1-2-atmel-start-Studio7-open-objects.png
Normal file
|
After Width: | Height: | Size: 107 KiB |
BIN
bsp/microchip/doc/3-1-3-atmel-start-Studio7-import-debug.png
Normal file
|
After Width: | Height: | Size: 266 KiB |
BIN
bsp/microchip/doc/3-1-4-atmel-start-Studio7-select-device.png
Normal file
|
After Width: | Height: | Size: 276 KiB |
BIN
bsp/microchip/doc/3-1-5-atmel-start-Studio7-project-complete.png
Normal file
|
After Width: | Height: | Size: 98 KiB |
|
After Width: | Height: | Size: 91 KiB |
BIN
bsp/microchip/doc/3-1-7-atmel-start-Studio7-select-tools.png
Normal file
|
After Width: | Height: | Size: 74 KiB |
BIN
bsp/microchip/doc/3-1-8-atmel-start-Studio7-start-debugging1.png
Normal file
|
After Width: | Height: | Size: 73 KiB |
BIN
bsp/microchip/doc/3-1-8-atmel-start-Studio7-start-debugging2.png
Normal file
|
After Width: | Height: | Size: 86 KiB |
BIN
bsp/microchip/doc/3-1-8-atmel-start-Studio7-start-debugging3.png
Normal file
|
After Width: | Height: | Size: 92 KiB |
BIN
bsp/microchip/doc/4-1-1-atmel-start-Studio7-reimport-project.png
Normal file
|
After Width: | Height: | Size: 98 KiB |
|
After Width: | Height: | Size: 106 KiB |
BIN
bsp/microchip/doc/5-1-1-atmel-start-driver-can0.png
Normal file
|
After Width: | Height: | Size: 133 KiB |
BIN
bsp/microchip/doc/5-1-1-atmel-start-driver-can1.png
Normal file
|
After Width: | Height: | Size: 188 KiB |
648
bsp/microchip/samc21/.config
Normal file
6
bsp/microchip/samc21/.ignore_format.yml
Normal file
@@ -0,0 +1,6 @@
|
||||
# files format check exclude path, please follow the instructions below to modify;
|
||||
# If you need to exclude an entire folder, add the folder path in dir_path;
|
||||
# If you need to exclude a file, add the path to the file in file_path.
|
||||
|
||||
dir_path:
|
||||
- bsp
|
||||
31
bsp/microchip/samc21/Kconfig
Normal file
@@ -0,0 +1,31 @@
|
||||
mainmenu "RT-Thread Configuration"
|
||||
|
||||
config BSP_DIR
|
||||
string
|
||||
option env="BSP_ROOT"
|
||||
default "."
|
||||
|
||||
config RTT_DIR
|
||||
string
|
||||
option env="RTT_ROOT"
|
||||
default "../../.."
|
||||
|
||||
# you can change the RTT_ROOT default: "rt-thread"
|
||||
|
||||
config PKGS_DIR
|
||||
string
|
||||
option env="PKGS_ROOT"
|
||||
default "packages"
|
||||
|
||||
source "$RTT_DIR/Kconfig"
|
||||
source "$PKGS_DIR/Kconfig"
|
||||
source "board/Kconfig"
|
||||
|
||||
config SOC_SAMC21
|
||||
bool
|
||||
select ARCH_ARM
|
||||
select ARCH_ARM_CORTEX_M
|
||||
select ARCH_ARM_CORTEX_M0
|
||||
select RT_USING_COMPONENTS_INIT
|
||||
select RT_USING_USER_MAIN
|
||||
default y
|
||||
70
bsp/microchip/samc21/README.md
Normal file
@@ -0,0 +1,70 @@
|
||||
# SAMC21J18A BSP Introduction
|
||||
|
||||
[中文](README_zh.md)
|
||||
|
||||
- MCU: ATSAMC21J18A @64MHz, 256KB FLASH, 32KB RAM, 2.7V – 5.5V
|
||||
- C21: Cortex-M0+ + Advanced Feature Set + 2x CAN-FD + Delta-Sigma ADC
|
||||
- Pin: N=100 pins, J=64 pins, G=48 pins, E=32 pins
|
||||
- Flash: 18=256KB, 17=128KB, 16=64KB , 15=32KB(size=2^n)
|
||||
- SRAM : 32KB(Flash 256KB), 16KB(Flash 128KB), 8KB(Flash 64KB), 4KB(Flash 32KB)
|
||||
## Datasheet: <https://www.microchip.com/en-us/product/ATSAMC21J18A>
|
||||
|
||||
#### KEY FEATURES
|
||||
|
||||
#### Core
|
||||
- 32-bit Arm® Cortex®-M0+ CPU running at up to 48 MHz or 64 MHz with Single-cycle hardware multiplier
|
||||
|
||||
#### Memories
|
||||
- 32/64/128/256 KB in-system self-programmable Flash
|
||||
- 1/2/4/8 KB independent self-programmable Flash for EEPROM emulation
|
||||
- 4/8/16/32 KB SRAM main memory
|
||||
|
||||
#### System
|
||||
- Power-on Reset (POR) and Brown-out Detection (BOD)
|
||||
- Internal and external clock options with 48 MHz to 96 MHz Fractional Digital Phase Locked Loop (FDPLL96M)
|
||||
- External Interrupt Controller (EIC) (Interrupt pin debouncing is only available in SAM C20/C21 N)
|
||||
- 16 external interrupts
|
||||
- One non-maskable interrupt
|
||||
- Two-pin Serial Wire Debug (SWD) programming, test, and debugging interface
|
||||
|
||||
#### High-Performance Peripherals
|
||||
- Hardware Divide and Square Root Accelerator (DIVAS)
|
||||
- 12-channel Direct Memory Access Controller (DMAC)
|
||||
- 12-channel Event System
|
||||
- Up to eight 16-bit Timer/Counters (TC), configurable as either
|
||||
- Two 24-bit and one 16-bit Timer/Counter for Control (TCC), with extended functions
|
||||
- Frequency Meter (The division reference clock is only available in the SAM C21N)
|
||||
- 32-bit Real Time Counter (RTC) with clock/calendar function
|
||||
- Watchdog Timer (WDT)
|
||||
- CRC-32 generator
|
||||
- Up to two Controller Area Network (CAN) interfaces in the SAM C21
|
||||
- Up to eight Serial Communication Interfaces (SERCOM), each configurable to operate as USART/I2C/SPI
|
||||
- One Configurable Custom Logic (CCL)
|
||||
- Up to Two 12-bit, 1 Msps Analog-to-Digital Converter (ADC) with up to 12 channels each (20 unique channels)
|
||||
- One 16-bit Sigma-Delta Analog-to-Digital Converter (SDADC) with up to 3 differential channels in the SAM C21
|
||||
- 10-bit, 350 ksps Digital-to-Analog Converter (DAC) in the SAM C21
|
||||
- Up to four Analog Comparators (AC) with Window Compare function
|
||||
- Integrated Temperature Sensor in the SAM C21
|
||||
- Peripheral Touch Controller (PTC)
|
||||
- 256-Channel capacitive touch
|
||||
|
||||
#### I/O
|
||||
- Up to 84 programmable I/O pins
|
||||
|
||||
#### Qualification
|
||||
- AEC - Q100 Grade 1 (-40°C to 125°C)
|
||||
|
||||
#### Voltage
|
||||
- 2.7V – 5.5V
|
||||
- -40°C to +125°C, DC to 48 MHz
|
||||
- -40°C to +85°C, DC to 64 MHz
|
||||
|
||||
#### Packages
|
||||
- 100-pin TQFP
|
||||
- 64-pin TQFP, VQFN
|
||||
- 56-pin WLCSP
|
||||
- 48-pin TQFP, VQFN
|
||||
- 32-pin TQFP, VQFN
|
||||
|
||||
#### Board info
|
||||
- [SAM C21 XPLAINED PRO](https://www.microchip.com/en-us/development-tool/ATSAMC21-XPRO)
|
||||
70
bsp/microchip/samc21/README_zh.md
Normal file
@@ -0,0 +1,70 @@
|
||||
# SAMC21J18A BSP 介绍
|
||||
|
||||
[English](README.md)
|
||||
|
||||
- MCU: ATSAMC21J18A @64MHz, 256KB FLASH, 32KB RAM, 2.7V – 5.5V
|
||||
- C21: Cortex-M0+内核 + 丰富外设 + 2路CAN-FD + Delta-Sigma ADC
|
||||
- 管脚: N系列-100 pins, J系列-64 pins, G系列-48 pins, E系列-32 pins
|
||||
- Flash: 18=256KB, 17=128KB, 16=64KB , 15=32KB(size=2^n)
|
||||
- SRAM : 32KB(Flash 256KB), 16KB(Flash 128KB), 8KB(Flash 64KB), 4KB(Flash 32KB)
|
||||
## 手册: <https://www.microchip.com/en-us/product/ATSAMC21J18A>
|
||||
|
||||
#### KEY FEATURES
|
||||
|
||||
#### 内核
|
||||
- 32-bit Arm® Cortex®-M0+ 内核, 主频最高48MHz和64 MHz+单指令周期的硬件乘法器
|
||||
|
||||
#### 内存
|
||||
- 32/64/128/256 KB in-system self-programmable Flash
|
||||
- 1/2/4/8 KB independent self-programmable Flash for EEPROM emulation
|
||||
- 4/8/16/32 KB SRAM main memory
|
||||
|
||||
#### 系统特性
|
||||
- Power-on Reset (POR) and Brown-out Detection (BOD)
|
||||
- Internal and external clock options with 48 MHz to 96 MHz Fractional Digital Phase Locked Loop (FDPLL96M)
|
||||
- External Interrupt Controller (EIC) (Interrupt pin debouncing is only available in SAM C20/C21 N)
|
||||
- 16 external interrupts
|
||||
- One non-maskable interrupt
|
||||
- Two-pin Serial Wire Debug (SWD) programming, test, and debugging interface
|
||||
|
||||
#### 高性能外设
|
||||
- Hardware Divide and Square Root Accelerator (DIVAS)
|
||||
- 12-channel Direct Memory Access Controller (DMAC)
|
||||
- 12-channel Event System
|
||||
- Up to eight 16-bit Timer/Counters (TC), configurable as either
|
||||
- Two 24-bit and one 16-bit Timer/Counter for Control (TCC), with extended functions
|
||||
- Frequency Meter (The division reference clock is only available in the SAM C21N)
|
||||
- 32-bit Real Time Counter (RTC) with clock/calendar function
|
||||
- Watchdog Timer (WDT)
|
||||
- CRC-32 generator
|
||||
- Up to two Controller Area Network (CAN) interfaces in the SAM C21
|
||||
- Up to eight Serial Communication Interfaces (SERCOM), each configurable to operate as USART/I2C/SPI
|
||||
- One Configurable Custom Logic (CCL)
|
||||
- Up to Two 12-bit, 1 Msps Analog-to-Digital Converter (ADC) with up to 12 channels each (20 unique channels)
|
||||
- One 16-bit Sigma-Delta Analog-to-Digital Converter (SDADC) with up to 3 differential channels in the SAM C21
|
||||
- 10-bit, 350 ksps Digital-to-Analog Converter (DAC) in the SAM C21
|
||||
- Up to four Analog Comparators (AC) with Window Compare function
|
||||
- Integrated Temperature Sensor in the SAM C21
|
||||
- Peripheral Touch Controller (PTC)
|
||||
- 256-Channel capacitive touch
|
||||
|
||||
#### I/O管脚
|
||||
- 最多提供84个用户可编程I/O管脚
|
||||
|
||||
#### 汽车应用
|
||||
- AEC - Q100 Grade 1 (-40°C to 125°C)
|
||||
|
||||
#### 工作电压
|
||||
- 2.7V – 5.5V
|
||||
- -40°C to +125°C, DC to 48 MHz
|
||||
- -40°C to +85°C, DC to 64 MHz
|
||||
|
||||
#### 封装
|
||||
- 100-pin TQFP
|
||||
- 64-pin TQFP, VQFN
|
||||
- 56-pin WLCSP
|
||||
- 48-pin TQFP, VQFN
|
||||
- 32-pin TQFP, VQFN
|
||||
|
||||
#### 官方开发板信息
|
||||
- [SAM C21 XPLAINED PRO](https://www.microchip.com/en-us/development-tool/ATSAMC21-XPRO)
|
||||
14
bsp/microchip/samc21/SConscript
Normal file
@@ -0,0 +1,14 @@
|
||||
# for module compiling
|
||||
import os
|
||||
from building import *
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
objs = []
|
||||
list = os.listdir(cwd)
|
||||
|
||||
for d in list:
|
||||
path = os.path.join(cwd, d)
|
||||
if os.path.isfile(os.path.join(path, 'SConscript')):
|
||||
objs = objs + SConscript(os.path.join(d, 'SConscript'))
|
||||
|
||||
Return('objs')
|
||||
41
bsp/microchip/samc21/SConstruct
Normal file
@@ -0,0 +1,41 @@
|
||||
import os
|
||||
import sys
|
||||
import rtconfig
|
||||
|
||||
if os.getenv('RTT_ROOT'):
|
||||
RTT_ROOT = os.getenv('RTT_ROOT')
|
||||
else:
|
||||
RTT_ROOT = os.path.normpath(os.getcwd() + '/../../..')
|
||||
|
||||
sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
|
||||
try:
|
||||
from building import *
|
||||
except:
|
||||
print('Cannot found RT-Thread root directory, please check RTT_ROOT')
|
||||
print(RTT_ROOT)
|
||||
exit(-1)
|
||||
|
||||
TARGET = 'rt-thread-' + rtconfig.DEVICE_PART + '.' + rtconfig.TARGET_EXT
|
||||
|
||||
DefaultEnvironment(tools=[])
|
||||
env = Environment(tools = ['mingw'],
|
||||
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
|
||||
CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
|
||||
AR = rtconfig.AR, ARFLAGS = '-rc',
|
||||
CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS,
|
||||
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
|
||||
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
|
||||
|
||||
if rtconfig.PLATFORM == 'iar':
|
||||
env.Replace(CCCOM = ['$CC $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -o $TARGET $SOURCES'])
|
||||
env.Replace(ARFLAGS = [''])
|
||||
env.Replace(LINKCOM = env["LINKCOM"] + ' --map rt-thread-'+ rtconfig.DEVICE_PART + '.map')
|
||||
|
||||
Export('RTT_ROOT')
|
||||
Export('rtconfig')
|
||||
|
||||
# prepare building environment
|
||||
objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False)
|
||||
|
||||
# make a building
|
||||
DoBuilding(TARGET, objs)
|
||||